1
在UIViewController上更新基於NSTimer的UIImage View和UITextView。在顯示iAd的UIViewController和右下方的iAd上有UIToolbar。當點擊iAd然後解散時,UIViewController上的UIToolbar消失。任何人都知道原因是什麼?iAd解除後UIToolbar消失
- (void)viewDidLoad
{
[super viewDidLoad];
float _gap = 1;
myTimer = [NSTimer scheduledTimerWithTimeInterval:_gap
target:self
selector:@selector(onTimer)
userInfo:nil
repeats:NO];
_adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 380, 320, 25)];
_adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
_adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
_adView.delegate=self;
self.bannerIsVisible=YES;
[self.view addSubview:_adView];
}
-(void) onTimer {
if (index < [textArray count])
{
self.textView.text = [self.textArray objectAtIndex:index];
self.imageView.image = [self.imagesArray objectAtIndex:index];
index++;
thisTimer = [NSTimer scheduledTimerWithTimeInterval:1.70 target:self selector:@selector(ViewTiming) userInfo:nil repeats:NO];
}else{
// index = 0;
ViewController *viewController = [[ViewController alloc] init];
viewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:viewController animated:YES completion:NULL];
}}
-(void)ViewTiming{
if (index == 1) {
self.textView.text = [self.textArray objectAtIndex:index];
self.imageView.image = [self.imagesArray objectAtIndex:index];
index++;
aTimer = [NSTimer scheduledTimerWithTimeInterval:2.55 target:self selector:@selector(Second) userInfo:nil repeats:NO];
}}
-(void)Second{
if (index == 2){
self.textView.text = [self.textArray objectAtIndex:index];
self.imageView.image = [self.imagesArray objectAtIndex:index];
index++;
aTimer = [NSTimer scheduledTimerWithTimeInterval:2.80 target:self selector:@selector(Third) userInfo:nil repeats:NO];
}}
-(void)Third{
if (index == 3){
self.textView.text = [self.textArray objectAtIndex:index];
self.imageView.image = [self.imagesArray objectAtIndex:index];
index++;
aTimer = [NSTimer scheduledTimerWithTimeInterval:2.95 target:self selector:@selector(Fourth) userInfo:nil repeats:NO];
}}
-(void)Fourth{
if (index == 4){
self.textView.text = [self.textArray objectAtIndex:index];
self.imageView.image = [self.imagesArray objectAtIndex:index];
index++;
aTimer = [NSTimer scheduledTimerWithTimeInterval:3.00 target:self selector:@selector(Fifth) userInfo:nil repeats:NO];
}}
-(void)Fifth{
if (index == 5){
self.textView.text = [self.textArray objectAtIndex:index];
self.imageView.image = [self.imagesArray objectAtIndex:index];
index++;
aTimer = [NSTimer scheduledTimerWithTimeInterval:3.00 target:self selector:@selector(Sixth) userInfo:nil repeats:NO];
}}
感謝您的幫助。
感謝您的回答。這正是解決我的問題。這很簡單。 – user1120133