ios - Shared iAd Banner doesn't appear between TableViews -
based on tutorial @ http://www.youtube.com/watch?v=u5xcvnhcq0w , implemented shared iad banner view show between header position of 2 tables. 2 table controllers under navigation controller. banner view showing in first table, not showing in next table.
same code implemented in uitableviewcontrollers
- (appdelegate *) appdelegate { return (appdelegate *)[[uiapplication sharedapplication] delegate]; } -(cgfloat)tableview:(uitableview *)tableview heightforheaderinsection:(nsinteger)section{ return 100.0; } -(void) viewwillappear:(bool)animated{ _uiiad = [[self appdelegate] uiiad]; _uiiad.delegate = self; [_uiiad setframe:cgrectmake(0,21,320,50)]; [self.view addsubview:_uiiad]; } -(void) viewwilldisappear:(bool)animated{ _uiiad.delegate = nil; _uiiad=nil; [_uiiad removefromsuperview]; } -(void)bannerviewdidloadad:(adbannerview *)banner{ nslog(@"ads loaded"); [uiview beginanimations:nil context:nil]; [uiview setanimationduration:1]; [_uiiad setalpha:1]; [uiview commitanimations]; } -(void)bannerview:(adbannerview *)banner didfailtoreceiveadwitherror:(nserror *)error{ nslog(@"ads not loaded"); [uiview beginanimations:nil context:nil]; [uiview setanimationduration:1]; [_uiiad setalpha:0]; [uiview commitanimations]; }
Comments
Post a Comment