简体   繁体   English

具有故事板的UITabBarController中的iAd

[英]iAd in UITabBarController with Storyboards

I am trying to add iAd into my tab based app which is setup using Storyboards. 我正在尝试将iAd添加到基于故事板设置的基于标签的应用中。 I am following the TabbedBanner example in the iAdSuite sample code from apple. 我正在遵循来自Apple的iAdSuite示例代码中的TabbedBanner示例。 I have imported the BannerViewController and have set the following: 我已导入BannerViewController并设置了以下内容:

- (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];
}

I have added the following to my SummaryViewController 我已经将以下内容添加到我的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];
}

The ad is currently appearing below the tab bar? 该广告当前显示在标签栏下方吗? Also, the content of my view has disappeared. 此外,我的观点内容也消失了。

**Don't use nil for bundle in the last snippet of code. **请勿在代码的最后一片段中将nil用作bundle Use [NSBundle mainBundle] . 使用[NSBundle mainBundle]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM