2013-03-18 135 views
1

我想添加iAd到我的基於標籤的應用程序使用故事板設置。我遵循Apple的iAdSuite示例代碼中的TabbedBanner示例。我已經進口BannerViewController並進行如下設置:iAd在UITabBarController與故事板

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    UITabBarController* tabBarController = (id)self.window.rootViewController; 
CGRect tabBarViewFrame = tabBarController.view.frame; 
tabBarViewFrame.origin.y -= application.statusBarFrame.size.height; 
tabBarViewFrame.size.height += application.statusBarFrame.size.height; 
tabBarController.view.frame = tabBarViewFrame; 

self.window.rootViewController = [[BannerViewController alloc] initWithContentViewController:tabBarController]; 
} 

我加入以下到我的SummaryViewController

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 

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

的廣告目前正在出現的標籤欄下方?而且,我的觀點的內容已經消失。

回答

0

**請勿在最後一段代碼中使用nil代替bundle。使用[NSBundle mainBundle]