One workaround is to shrink the size of the view to be displayed by the UITabBarController by subclass UITabBarController.
@interface MyTabBarController : UITabBarController
@end
@implementation MyTabBarController
// Workaround for iOS UITabBarController layout issue.
// In iOS7, the tab bar overlaps with the view to be displayed.
// The height of the view to be displayed with a UITabBarController needs
// to be shrinked by the height of the tab bar.
-(void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
if (!IOS7_OR_UP)
return;
static int barHeight = 0;
if (barHeight == 0) {
UIView* bar = findViewOfClass(self.view, NSClassFromString(@"UITabBar"));
barHeight = bar.frame.size.height;
}
UIView* CV = (UIView*)self.view.subviews.firstObject;
CV.autoresizesSubviews = YES;
UIView* GCV = (UIView*) CV.subviews.firstObject;
UIView* GGCV = (UIView*) GCV.subviews.firstObject;
CGRect frame = CV.frame;
frame.size.height = self.view.frame.size.height - barHeight;
CV.frame = frame;
GCV.frame = frame;
GGCV.frame = frame;
}
@end
No comments:
Post a Comment