UITabBarController选中了tab bug(?)

时间:2012-05-02 19:10:46

标签: ios uitabbarcontroller

我的应用程序有一个带有4个选项卡的UITabBarController,从父级显示为模态视图控制器。应用程序完全支持横向,因此可以随时进行布局。

有一个非常奇怪的错误,我上个月只见过5次。不知何故,在一些操作之后(用户无法确定顺序,但显然涉及方向更改),所选标签项保持“横向”,而其他操作正确定位。 我无法提供更多信息,因为它是一个非常后方的错误。

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

屏幕截图:enter image description here

1 个答案:

答案 0 :(得分:1)

您可以尝试在- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation中的每个UIViewController上实施UITabBarController,然后在轮播后设置tabBarController的@property(nonatomic) NSUInteger selectedIndex属性?

我之前没有尝试过,但它可以工作......像这样:

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