diz*_*izy 6 uitabbarcontroller ipad
这似乎是一个错误,但我想知道是否有人能想到一个解决方法.
在iPad上,您将视图控制器显示为UIModalPresentationFormSheet.这个视图控制器正在扩展UITabBarController,并有足够的控制器来自动显示"更多"标签栏按钮.点击更多按钮后,它将正确显示列表,但只要点击"编辑",它就会显示比实际表单更大的编辑视图(在表单内部裁剪),导致内容不在视图,包括带有"完成"按钮的工具栏.解雇的唯一方法是强制退出应用程序.
为了验证它不是我的应用程序特有的东西,我启动了一个单一的视图项目,并提出了一个简单的模态视图.这个模态视图控制器扩展了UITabBarController并具有以下init方法:
- (id)init {
self = [super init];
if (self) {
self.modalPresentationStyle = UIModalPresentationFormSheet;
NSMutableArray *controllers = [NSMutableArray array];
for (int i = 0; i< 15; i++) {
UIViewController *vc = [[UIViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
vc.title = [NSString stringWithFormat:@"view %i", i];
[controllers addObject:nav];
}
self.viewControllers = controllers;
}
return self;
}
Run Code Online (Sandbox Code Playgroud)
我也尝试将modalPresentationStyle添加到moreNavigationController而不做任何更改.
美好的一天,头晕。
\n\n你所做的一个很好的挑战。这是一个解决方案,也许有点硬核,但它有效。
\n\n我已经按照您编写的 \xe2\x80\x93 子类化 UITabBarController 并将其呈现为模式视图控制器。并遇到同样的问题。当点击“更多”屏幕中的“编辑”按钮时,会出现 UITabBarCustomizeView,但它的框架不足。
\n\n所以我做了以下事情。我已将 MyModalTabBarVC 设为其自身的委托并实现了tabBarController:willBeginCustomizingViewControllers:方法:
- (void)tabBarController:(UITabBarController *)tabBarController \nwillBeginCustomizingViewControllers:(NSArray *)viewControllers\n{\n UIView *modalView = self.view;\n CGRect bounds = modalView.bounds;\n\n UIView *customizationView = [[modalView subviews] objectAtIndex:1];\n UIView *customizationNavBar = [[customizationView subviews] objectAtIndex:0];\n\n CGRect navBarFrame = [customizationNavBar frame];\n navBarFrame.size.width = bounds.size.width;\n customizationNavBar.frame = navBarFrame;\n customizationView.frame = bounds;\n}\nRun Code Online (Sandbox Code Playgroud)\n\n所以当调用这个方法的时候UITabBarCustomizeView已经创建好了。并且可以手动更改错误的帧。如果您po [self.view subviews]在开始时登录,您将得到:
(id) $1 = 0x06c6a940 <__NSArrayM 0x6c6a940>(\n<UITransitionView: 0xd744ab0; frame = (0 0; 540 571); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0xd744b50>>,\n<UITabBarCustomizeView: 0x6c5e570; frame = (0 -384; 768 1004); animations = { position=<CABasicAnimation: 0x6c569a0>; }; layer = <CALayer: 0x6c618d0>>,\n<UITabBar: 0xd744110; frame = (0 571; 540 49); autoresize = W+TM; layer = <CALayer: 0xd742b80>>,\n)\nRun Code Online (Sandbox Code Playgroud)\n\n附言。此解决方案不能修复动画。正如您从日志中看到的,损坏的动画已经创建并收费。我希望取消它并适当添加一个新的,不会成为问题。
\n| 归档时间: |
|
| 查看次数: |
618 次 |
| 最近记录: |