I experimented with this and decided that tabBarController will automatically resize its view and undo all your changes if one of the following events occurs:
- the value of selectedViewController changes;
- interface orientation changes;
- the tab bar (re) is loaded and placed inside the viewport /.
I managed to get the UITabBar view to remain constant by registering for all of the above events and then calling the custom resize method from them.
You can watch the changes in selectedViewController using KVO, for example:
[tabBarController addObserver:self forKeyPath:@"selectedViewController" options:NSKeyValueObservingOptionNew context:NULL]
. , , , UIViewController . : (1) UIDevice (2) . , UIDevice, , , . :
extern NSString *const kOrinetationNotification;
extern NSString *const kOrinetationNotificationOrientationKey;
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[[NSNotificationCenter defaultCenter] postNotificationName:kOrientationNotification object:self userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:toInterfaceOrientation] forKey:kOrientationNotificationOrientationKey]];
}
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationDidChange:) name:kOrientationNotification object:nil];
, , - , . , , , , .