0
我想在XCode 5的屏幕底部放置一個子視圖,但它在運行應用程序時會在底部留下20px的空間。在xCode Storyboard中使用視圖,但框架安裝不正確
我也改變了Deltas,不知道是什麼原因造成的。
我的代碼如下所示:
[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
)];
}
另外,你在-viewWillLayoutSubViews中調用你的代碼?這就是我所說的。 –
不,我不把我的代碼放在那裏馬特。我還沒有創建這個類。你說'相應調整',但我會建議什麼?歡迎提出問題,但感謝您的幫助 – Omar
好吧,我現在就開始工作了,謝謝!除了在iPhone 4上沒有顯示的情況。只有在iPhone 5.有什麼我應該改變編程? – Omar