【发布时间】:2014-07-09 16:27:07
【问题描述】:
我有一个 UINavigationBar,其中有一个 AuthenticateViewController。然后当用户在我的导航控件右上角登录时,我想显示一个 UITabBar 控制器。我仍然在 appDelegate 中创建它吗?如何“突破” UINavigation 控制器?
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
// Add methods for layout of this view controller here
//1
AppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
//2
self.managedObjectContext = appDelegate.managedObjectContext;
[self.navigationItem setHidesBackButton:YES];
// Now add the Sign In button
UIBarButtonItem *signinButton = [[UIBarButtonItem alloc] initWithTitle:@"Sign In" style:UIBarButtonItemStylePlain target:self action:@selector(signinButtonPressed:)];
self.navigationItem.rightBarButtonItem = signinButton;
}
- (void) signinButtonPressed:(UIBarButtonItem *) sender
{
// What goes here to start the UITabBars
}
【问题讨论】:
-
您是否要导航到一个新页面(登录后),您可以在其中看到标签栏?
-
是的,我希望导航栏消失,并使用带有几个标签的新标签栏控制器。
-
因此,您仍然可以创建一个标签栏控制器,然后在按下登录按钮时将其与导航控制器一起推送。然后,您可以将导航栏隐藏在顶部。明白了吗?
标签: ios ios7 uitabbarcontroller uinavigationbar uitabbar