我使用xib而不是故事板在UITabBarController
上工作。
在iPhone中UITabBarItem
框架正确并选择项目成功但当我们在iPad上运行应用程序时,UITabBar
框架会显示iPhone UITabBar
框架并且我正在更改{{1 }}但是未设置UITabBar
的选择
我们如何更改UITabBarItem
。
答案 0 :(得分:0)
检查我的标签条形码
`self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; //在应用程序启动后覆盖自定义点。 self.viewController = [[ViewController alloc] initWithNibName:@" ViewController~ipad"捆绑:无]; _NavController = [[UINavigationController alloc] initWithRootViewController:self.viewController]; tabBar = [[UITabBarController alloc] init];
[[UITabBar appearance] setSelectionIndicatorImage:[[UIImage alloc] init]];
console=[[ConsoleViewController alloc] initWithNibName:@"ConsoleViewController~ipad" bundle:nil];
// console.title=@"Start";
tagViewObj=[[TagsViewViewController alloc] initWithNibName:@"TagsViewViewController~ipad" bundle:nil];
//tagViewObj.title=@"Tags";
SettingsObj=[[SettingsViewController alloc] initWithNibName:@"SettingsViewController~ipad" bundle:nil];
UINavigationController *Navcontroller1=[[UINavigationController alloc] initWithRootViewController:console];
UINavigationController *Navcontroller2=[[UINavigationController alloc] initWithRootViewController:tagViewObj];
UINavigationController *Navcontroller3=[[UINavigationController alloc] initWithRootViewController:SettingsObj];
tabBar.viewControllers=[NSArray arrayWithObjects:Navcontroller1,Navcontroller2,Navcontroller3, nil];`
答案 1 :(得分:0)
使用UITabBar
属性itemWidth
self.tabBar.itemWidth = [UIScreen mainScreen].bounds.size.width/self.viewControllers.count;
@property(nonatomic) CGFloat itemWidth NS_AVAILABLE_IOS(7_0) UI_APPEARANCE_SELECTOR;