5
我試圖創建一個自定義的UITabbar使用圖像的選定和未選中狀態。ios7 - 自定義UItabbar在底部有一個空白
這是我的代碼:
if ([UIImage instancesRespondToSelector:@selector(imageWithRenderingMode:)]) {
tab_01_on_image = [[UIImage imageNamed:@"Tabbar_on_01"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab_01_off_image = [[UIImage imageNamed:@"Tabbar_off_01"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
} else {
tab_01_on_image = [UIImage imageNamed:@"Tabbar_on_01"] ;
tab_01_off_image = [UIImage imageNamed:[email protected]"Tabbar_off_01"] ;
}
[[[self.tabBarController.tabBar items] objectAtIndex:index] setFinishedSelectedImage:tab_01_on_image withFinishedUnselectedImage:tab_01_off_image];
此圖像顯示了問題,紅色就是差距:
編輯添加的代碼來創建UITabbar
self.tabBarController = [[BaseTabbarController alloc] init];
self.tabBarController.delegate = self;
self.tabBarController.viewControllers = @[navControll1, navControll2, navControll3, navControll4, navControll5];
self.window.rootViewController = self.tabBarController;
我感謝你們提供的任何幫助
Tabbar_on_01有多高? – Ilario
@ 2x圖像是128x100px 我也嘗試過128x98px並得到了同樣的問題。 – FelipeOliveira
您的視圖是使用Interface Builder設計的,還是以編程方式創建它? – zbMax