我试图在 XCode 5 中将子视图放置在屏幕底部,但在运行应用程序时它会在底部留下 20px 的空间。
我也改变了三角洲,不知道是什么原因造成的。
我的代码如下所示:
[bannerView setFrame:CGRectMake([UIScreen mainScreen].bounds.size.width-bannerView.frame.size.width,
[UIScreen mainScreen].bounds.size.height-bannerView.frame.size.height - [UIApplication sharedApplication].statusBarFrame.size.height,
bannerView.frame.size.width,
bannerView.frame.size.height
)];
我的代码如下所示:
- (void)viewDidLoad
{
[super viewDidLoad];
// Load Ad
self.bannerView.requestURL = @"http://adsivv.com/md.request.php";
self.bannerView.delegate = self;
- (void) viewWillLayoutSubViews {
NSLog(@"bannerView frame: %@", NSStringFromCGRect(bannerView.frame));
[bannerView setFrame:CGRectMake([UIScreen mainScreen].bounds.size.width-bannerView.frame.size.width,
[UIScreen mainScreen].bounds.size.height-bannerView.frame.size.height - [UIApplication sharedApplication].statusBarFrame.size.height,
bannerView.frame.size.width,
bannerView.frame.size.height
)];
}