2012-05-02 70 views
1

我的应用程序有一个UITabBarController有4个选项卡,从父级显示为模式视图控制器。应用程序全面支持横向导向,因此布局可随时发生。UITabBarController选择选项卡错误(?)

有一个非常奇怪的错误,我在上个月只看过5次。在某些操作之后(用户不能确切地确定顺序,但显然涉及方向更改),选定的选项卡项目保持“横向”状态,而其他位置正确定位。 我不能提供更多的信息,因为它是一个非常后面的错误。

编辑:它也发生在另一个人写的另一个应用程序,所以这可能实际上是一个iOS错误。

截图:enter image description here

回答

1

你可以尝试在你的UITabBarController实现每个UIViewController- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation,然后设置tabBarController的@property(nonatomic) NSUInteger selectedIndex财产旋转后?

我以前没有尝试过,但它可以工作......事情是这样的:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { 
     [[self tabBarController] setSelectedIndex:[[self tabBarController] selectedIndex]]; 
} 
+0

我在想迫使布局viewWillAppear中。但我希望有人已经面临这个问题,可能有解决方案或至少有解释。 – note173

+0

视为UITabBar继承UIView,你也可以尝试调用[[[self [tabBarController] tabBar] layoutSubviews]在旋转或viewWillAppear然后这很奇怪,这是发生...你是否自定义TabBar的外观或子类化它? – liamnichols

+0

不,我不是。这个问题似乎也出现在另一个人写的另一个应用程序中。 – note173

相关问题