UITabBarItem框架改变了吗?

时间:2015-05-13 09:51:13

标签: ios iphone ipad uitabbarcontroller

我使用xib而不是故事板在UITabBarController上工作。

在iPhone中UITabBarItem框架正确并选择项目成功但当我们在iPad上运行应用程序时,UITabBar框架会显示iPhone UITabBar框架并且我正在更改{{1 }}但是未设置UITabBar的选择  我们如何更改UITabBarItem

2 个答案:

答案 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];`

请参阅图片http://i.stack.imgur.com/faAdD.png

答案 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;