Bru*_*cha 10 tabbar ios iphone-x
我最近在我的应用程序上添加了对iOS 11的支持,这种情况开始发生.基本上,只要将ViewController添加到导航堆栈,标签栏就会在动画期间出现问题.
它只发生在iPhone X中,这只是一个常规的TabBarController.是什么造成的?
补充答案
这里有关于这个问题的雷达。
- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
// Disable tabBar shifts upward whenever a ViewController is pushed on iPhone X rdar://35098813
BOOL isIPhoneX = ...
if (isIPhoneX && UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
[self.tabBar setFrame:CGRectMake(0, CGRectGetHeight(self.view.frame) - CGRectGetHeight(self.tabBar.frame), CGRectGetWidth(self.view.frame), CGRectGetHeight(self.tabBar.frame))];
}
}
Run Code Online (Sandbox Code Playgroud)
原答案
我认为这是 iOS 11 的一个错误。您可以删除这个奇怪的效果,将此代码放入您的UITabBarController.
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
BOOL isIPhoneX = ...
if (isIPhoneX && UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
[self.tabBar setFrame:CGRectMake(0, self.view.frame.size.height - 83, 375, 83)];
}
}
Run Code Online (Sandbox Code Playgroud)
解决方案也很奇怪。:)
| 归档时间: |
|
| 查看次数: |
1131 次 |
| 最近记录: |