我想知道什么是最佳做法以及如何在屏幕底部显示广告横幅。我正在使用phonegap 2.5,我可以将它显示在屏幕顶部。这就是我创建adBannerView的方式。
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
// Black base color for background matches the native apps
theWebView.backgroundColor = [UIColor blackColor];
adView = [[[ADBannerView alloc] initWithFrame:CGRectZero] autorelease];
//adView.frame = CGRectMake(0, 410, 320, 50); // if you want the banner to be on top of the screen remove this line
adView.delegate = self;
adView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[theWebView addSubview:adView];
return [super webViewDidFinishLoad:theWebView];
}
由于iphone(4,5)具有不同的分辨率,我不确定我是否想要根据上面注释掉的线路来确定位置。请让我知道如何将它放在屏幕的底部。
感谢。
我尝试了link中的内容,但是我遇到了有关冲突约束的错误
答案 0 :(得分:1)
试试这个!
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
CGRect adFrame = adView.frame;
adFrame.origin.y = self.view.frame.size.height-adView.frame.size.height;
adView.frame = adFrame;
[theWebView addSubview:adView];