iAd在UITabBarController中使用Storyboard

时间:2013-03-18 19:00:51

标签: iphone ios xcode uitabbarcontroller iad

我正在尝试将iAd添加到基于标签的应用中,该应用是使用Storyboard设置的。我正在关注来自apple的iAdSuite示例代码中的TabbedBanner示例。我导入了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];
}

我已将以下内容添加到我的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];
}

广告目前显示在标签栏下方?此外,我的观点内容已经消失。

1 个答案:

答案 0 :(得分:0)

**请勿在最后一段代码中使用nil bundle。使用[NSBundle mainBundle]