My application has an UITabBarController with 4 tabs, presented as modal view controller from parent. Application has full support for landscape orientation, so layouts may occur at any time.
There is a very strange bug that I've seen only 5 times for the last month. Somehow after some operations (users can't tell the exact order, but it obviously involves orientation changes) selected tab item stays "landscape" while others get positioned properly. I can't provide more information because it's a very rear bug.
Edit: it also happens in another application written by another person, so this might be actually an iOS bug.
Screenshot:
You could try implementing the - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
on each UIViewController
in your UITabBarController
and then set the @property(nonatomic) NSUInteger selectedIndex
property of the tabBarController after the rotate?
I haven't tried it before but it could work... Something like this:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
[[self tabBarController] setSelectedIndex:[[self tabBarController] selectedIndex]];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.