【问题标题】:How to display the contents of view while using iAd如何在使用 iAd 时显示视图的内容
【发布时间】:2012-03-27 09:26:13
【问题描述】:

我正在使用以下代码在我的视图中显示 iAd。但我无法看到我在视图中使用的测试广告和内容。

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.

    CGRect bounds = [[UIScreen mainScreen] bounds];
    self.window = [[UIWindow alloc] initWithFrame:bounds];
    self.window.backgroundColor = [UIColor whiteColor];

    _bannerView = [[ADBannerView alloc] initWithFrame:CGRectMake(0.0, bounds.size.height, 0.0, 0.0)];
    _bannerView.delegate = self;


    sample *sampleClassObj=[[sample alloc]init];
    _navigationController =[[UINavigationController alloc]initWithRootViewController:sampleClassObj];
    _navigationController.delegate = self;

    self.window.rootViewController = _navigationController;
    [self.window makeKeyAndVisible];

    _currentController = nil;

//  self.currentController=(UIViewController<BannerViewContainer> *)viewController;

    return YES;
}

我已经完成了基本 iAd 实施的必要编码。 谁能告诉我我犯了什么错误,或者只是告诉我在我的项目中实施 iAd 的最简单方法。

我是 iPhone 开发人员的初学者,所以如果您找不到上述问题的解决方案,请告诉我实施 iAd 的分步过程。

提前致谢

【问题讨论】:

  • 我得到了解决方案。这个问题不用回答
  • 从堆栈溢出中删除问题

标签: iphone objective-c xcode


【解决方案1】:

尝试像这样初始化横幅视图(适当更改内容大小):

ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;

然后像这样将它添加到你的根视图控制器:

[sampleClassObj.view addSubview:adView];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-18
    • 2018-02-04
    • 2018-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-21
    相关资源
    最近更新 更多