1

UIViewController で、NSTimer に基づいて UIImage ビューと UITextView を更新します。iAd を表示している同じ UIViewController と iAd のすぐ下に UIToolbar があります。iAd をクリックして閉じると、UIViewController の 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];
}}

手伝ってくれてありがとう。

4

1 に答える 1

1

追加してみる

[self.view addSubview:toolbar]; 

ビューでDidLoad

それがあなたの問題を解決するかもしれません。

于 2013-04-12T18:00:47.030 に答える