Good afternoon, diz.
Good challenge you made. Here is a solution, maybe it's a bit hardcore, but it works.
I did as you wrote - subclassed the UITabBarController and introduced it as a modal controller. And to face the same problem. When you click the Edit button on the Advanced screen, a UITabBarCustomizeView appears and the frame is inadequate.
So, I did the following. I made MyModalTabBarVC my delegate and implemented the tabBarController:willBeginCustomizingViewControllers: method:
- (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers { UIView *modalView = self.view; CGRect bounds = modalView.bounds; UIView *customizationView = [[modalView subviews] objectAtIndex:1]; UIView *customizationNavBar = [[customizationView subviews] objectAtIndex:0]; CGRect navBarFrame = [customizationNavBar frame]; navBarFrame.size.width = bounds.size.width; customizationNavBar.frame = navBarFrame; customizationView.frame = bounds; }
So, when this method is called UITabBarCustomizeView , it is already created. And the wrong frame can be manually changed. If you write po [self.view subviews] at the beginning, you get:
(id) $1 = 0x06c6a940 <__NSArrayM 0x6c6a940>( <UITransitionView: 0xd744ab0; frame = (0 0; 540 571); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0xd744b50>>, <UITabBarCustomizeView: 0x6c5e570; frame = (0 -384; 768 1004); animations = { position=<CABasicAnimation: 0x6c569a0>; }; layer = <CALayer: 0x6c618d0>>, <UITabBar: 0xd744110; frame = (0 571; 540 49); autoresize = W+TM; layer = <CALayer: 0xd742b80>>, )
PS. This solution does not fix the animation. As you can see from the magazine, the damaged animation is already created and charged. I hope that canceling it and adding a new one will not be a problem.
source share