繁体   English   中英

UITabBarController选择的选项卡错误(?)

[英]UITabBarController selected tab bug (?)

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

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

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

屏幕截图: 在此处输入图片说明

您可以尝试在UITabBarController每个UIViewController上实现- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation ,然后在旋转后设置- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation @property(nonatomic) NSUInteger selectedIndex属性。

我以前没有尝试过,但是可以正常工作……

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM