【发布时间】:2014-02-24 14:09:04
【问题描述】:
所以我正在实现单例 iAD 系统,并获得了在视图上添加横幅的功能,但我如何确保横幅始终位于底部,以便它适用于 3.5 英寸和 4 英寸屏幕?
这是我的代码,但横幅无法正确定位,它会离开屏幕
-(void)attachBannerToViewController:(UIViewController*)viewController
{
if (_iAdBanner == nil) {
NSLog(@"iAdbanner alloc");
_iAdBanner = [[ADBannerView alloc] initWithAdType:ADAdTypeBanner];
_iAdBanner.delegate = self;
_iAdBanner.alpha = 0.0;
}
CGRect frame=CGRectZero;
frame.size = _iAdBanner.frame.size;
frame.origin = CGPointMake(0.0, viewController.view.frame.size.height-_iAdBanner.frame.size.height);
[_iAdBanner setFrame:frame];
[viewController.view addSubview:_iAdBanner];
}
【问题讨论】:
标签: ios cocoa-touch uiview ios7 iad