只是为了澄清事情,我不想使用UITabBarController. 我需要对UITabBar无法使用UITabBarController. (比如让它滚动等')
这就是我创建我的方式UITabBar
从 Interface Builder 中,我将 a 拖到
UITabBar了ViewControllers 中。连接代表和插座。
添加
UITabbarItem了标签和 segue 标识符。
并使用了这段代码:
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{
if (item.tag==0) {
[self performSegueWithIdentifier:@"Favorite" sender:nil];
}
else if (item.tag==1)
{
[self performSegueWithIdentifier:@"Item" sender:nil];
}
}
我的问题是,当我推一个新ViewController的UITabBar消失。UITabBar我的问题是,保持on pushViewController和 other ViewControllers的正确方法是什么?
我已经尝试使用它将它传递给下一个视图控制器PrepareForSegue并且它可以工作,但是当我回到我以前的控制器时,我需要重置UITabBar框架等'。我想我可以将它作为一个全局对象保留在我的 Singleton 中,并继续将其添加到 newViewController中,但这听起来像是过度杀戮有没有更好的方法来做到这一点而不使用 a UITabBarController?