в моем проекте мне пришлось установить фоновое изображение в UITabBar, для чего я переопределяю UITabBar следующим кодом:
@interface UITabBar (CustomImage)
@end
@implementation UITabBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"tab_bg.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
self.backgroundColor = [Constants getNavTintColor];
}
@end
Работало нормально. Мне также нужно было вращать UITabBarController, поэтому я использовал следующий код:
@interface UITabBarController (Autorotate)
@end
@implementation UITabBarController (Autorotate)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
UIViewController *controller = self.selectedViewController;
if ([controller isKindOfClass:[UINavigationController class]])
controller = [(UINavigationController *)controller visibleViewController];
return [controller shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}
@end
После добавления этой части поворота кода работает нормально, но часть UITabBar больше не работает. Что я должен делать? Любая помощь будет оценена.