【发布时间】:2015-06-16 09:33:44
【问题描述】:
我正在 UITabBarController 子类(“CustomTabBarVC”)中自定义 UITabBar。我想使用自定义选择指示器图像,所以我在“CustomTabBarVC”实现中写了这个:
- (void)viewWillLayoutSubviews
{
CGFloat tabItemWidth;
UIView *tabItem = [[[self.tabBar items] lastObject] view];
tabItemWidth = tabItem.frame.size.width;
UIImage *selectionIndicator;
// Set here 'selectionIndicator' to an UIImage which fits 'tabItemWidth' and tab bar's height
[[UITabBar appearance] setSelectionIndicatorImage:selectionIndicator];
}
当视图以纵向加载时,这可以正常工作,但是当我将设备的方向更改为横向时,虽然再次调用该方法并且selectionIndicator 图像似乎采用了新宽度,但它没有重绘并且以前的图像一直显示。我该怎么办?
谢谢
【问题讨论】:
标签: ios uiimage uitabbarcontroller uitabbar uitabbaritem