【发布时间】:2011-07-28 08:59:15
【问题描述】:
我已获得最新版本的 AdMob iOS 代码。它工作正常,但广告显示在我的标签栏下。如何将广告移到栏上方?这是我的相关代码:
#import "InformationViewController.h"
@implementation InformationViewController
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
// Create a view of the standard size at the bottom of the screen.
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
/* run something specific for the iPad */
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_300x250.height,
GAD_SIZE_300x250.width,
GAD_SIZE_300x250.height)];
}
else
{
/* run something specific for the iPhone */
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
}
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = MY_BANNER_UNIT_ID;
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:[GADRequest request]];
}
还有我的头文件 -
#import "GADBannerView.h"
#import <UIKit/UIKit.h>
@interface InformationViewController : UIViewController {
GADBannerView *bannerView_;
}
@end
【问题讨论】:
-
所以我看到了一个使用 TableView 的建议,但我不想为这个 App 使用 TableView。还有其他选择吗?
-
好吧,我继续研究这个,因为我在这里看到的答案不多。如果我找到它,我会发布一个。
-
我正在切换到 iAd 看看能否解决。
标签: iphone ipad admob tabbar ios4