1

我有选项卡式应用程序,我喜欢iAd根据空间可用性在每个视图上呈现不同的位置,所以我想添加iAd应用程序委托的功能并创建它的实例并根据要求使用它,以便在不同的选项卡式应用程序之间传递消息和我喜欢使用的视图NSNotificationCenter,但它没有调用assign方法,这是我的代码

     //this appdelegte.m


    - (void)layoutAnimated:(BOOL)animated
    {
        BOOL yy=    self.bannerView.bannerLoaded;
        if (yy==1)
        {  
            self.iAdString=[NSMutableString stringWithString:@"1"];
             [[NSNotificationCenter defaultCenter] postNotificationName:@"BannerViewActionWillBegin" object:self];

        }

        else

        {
             self.iAdString=[NSMutableString stringWithString:@"0"];

        }


    }

    - (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
    {
          postNotificationName:@"BannerViewActionDidFinish" object:self];

            [self layoutAnimated:YES];
   }

     //and i call this nsnotification in VieController.m like this


    -(void)viewWillAppear:(BOOL)animated 

    {


        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willBeginBannerViewActionNotification:) name:@"BannerViewActionWillBegin "object:nil];


        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFinishBannerViewActionNotification:) name:@"BannerViewActionDidFinish" object:nil];


     - (void)willBeginBannerViewActionNotification:(NSNotification *)notification


    {

        [self.view addSubview:self.app.bannerView];



    }



    - (void)didFinishBannerViewActionNotification:(NSNotification *)notification
    {
         NSLog(@"come");
        [self.app.bannerView removeFromSuperview];
     }
4

0 回答 0