I found this: A subclass of UITabBarController to set up its frame , which explains how to achieve what I was aiming for in return. To rephrase the message there, you need to register to receive notifications when the selected TabBarController view is selected, and then apply your geometry. Otherwise, it is reset by the TabBarController.
I am trying to resize my UITabBarController to show a message with a high status of 20px when certain tasks are performed. Curiously, if I go through a method that resizes the TabBarController, the origin of the frame will change.
When the view first appears, the source UITabBarController y is set to 0. Despite the fact that applicationatioinScreen y.origin is 20. If I changed the size when I first loaded the application, everything would be turned off. Subsections are not changed. After the first resize, if I look at another tab, the TabBarController will adjust to the desired size, and subsequent calls to the resize method will confirm this.
This is how I install the UITabBarcontroller:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UITabBarController *tabBarController = [[UITabBarController alloc] init];
[tabBarController setViewControllers:[AppController getGroupViewControllerArray] animated:NO];
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
return YES;
}
And this is how I resize the TabBarController:
-(void)resizeTabToShowActivity {
CGRect newFrame = mainTabBarController.view.frame;
CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame];
newFrame.origin.y = applicationFrame.origin.y + 20;
newFrame.size.height = applicationFrame.size.height - 20;
mainTabBarController.view.frame = newFrame;
}
I noticed that if I resized right after installing TabBarController in the window, everything will be fine. For debugging purposes, I also moved the resize method to AppDelegate, and there is still no joy.
thank
source
share