[英]iOS 7.1 issue - Tabbar resizing doesn't work
自從我更新到iOS 7.1后,選項卡的大小調整(為74像素)不再起作用:
[[tabBarController.view.subviews objectAtIndex:0] setFrame:CGRectMake(0, 0, 320, screenSize.height-73)];
[tabBarController.tabBar setFrame:CGRectMake(0, screenSize.height-73, 320, 74)];
此代碼導致選項卡向上移動,但下方有一些空白區域。
任何人都可以解決這個問題?
如果你改變你的大小UITabBar
在viewDidLayoutSubviews
你的UITabBarController
的子類,調整大小的iOS 7和7.1下工作。 以我的代碼為例:
- (void)viewDidLayoutSubviews
{
CGFloat tabBarHeight = 39.0;
CGRect frame = self.view.frame;
self.tabBar.frame = CGRectMake(0, frame.size.height - tabBarHeight, frame.size.width, tabBarHeight);
}
這是我目前使用的,我已經從標簽欄中刪除了圖像,然后我添加了這一段代碼來定位文本,我認為第二行已經過時但我仍然保留它。 for語句將文本放在欄中,因此你可以調整修改-25值,30是我的標簽欄高度的大小。 酒吧的其余部分在技術上“隱藏”在屏幕下方。
self.tabBar.frame = CGRectMake(0, screenHeight - 30, screenWidth, 30);
self.view.frame = CGRectMake(0, screenHeight - 30, screenWidth, 30);
for (int i = 0; i < self.tabBar.items.count; i++)
{
[[self.tabBar.items objectAtIndex:i] setTitlePositionAdjustment:UIOffsetMake(0, -25)];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.