iAd被解雇后,UIToolbar消失

时间:2013-04-12 15:23:43

标签: iphone ios6 iad

在UIViewController上基于NSTimer更新UIImage View和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];
}}

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

尝试添加

[self.view addSubview:toolbar]; 

在viewDidLoad

可能会解决您的问题。