下面的图片是我的故事板,我希望在Upcoming VC
展示AppDelegate
。以下是AppDelegate
处的代码。我设法在调用时显示Upcoming VC
。
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc=[sb instantiateViewControllerWithIdentifier:@"Upcoming"];
UINavigationController *nv = [[UINavigationController alloc] initWithRootViewController:vc];
nv.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self.window.rootViewController presentViewController:nv animated:YES completion:nil];
在Upcoming VC
,我设法显示navigationBar with title and background colour
但我的后退按钮<
仍然缺失。我的后退按钮是自动生成的。
-(void)viewWillAppear:(BOOL)animated{
self.navigationController.navigationBar.hidden = NO;
[self.navigationItem setHidesBackButton:FALSE];
//====Make the navigation Bar appear===
[self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage = nil;
//=== Set the navigation Back < color
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
[self.navigationController.navigationBar setBarTintColor : [ UIColor grayColor]];
//=== Set the navigation Bar text color
[self.navigationController.navigationBar
setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
self.navigationController.navigationBar.translucent = NO;
}
请帮忙。
答案 0 :(得分:1)
那么你期待什么?
仅当您从现有ViewController推送UpcomingVC
时,后退按钮才会显示 请记住,只需在故事板中使用导航栏,现在就会自动显示后退按钮。
您可以创建完整视图控制器层次结构
喜欢
UpcomingVC
已从HomeVC
推出,然后您可以将HomeVC
设置为UINavigationController
中嵌入的根视图控制器,并将其设置为您可以推送的下一行
动态为假的UpcomingVC
答案 1 :(得分:0)
您可以输入 从StoryBoard到StoryBoard
ViewControllerName * next = [self.storyboard instantiateViewControllerWithIdentifier:@"ViewControllerName"];
[self.navigationController pushViewController:next animated:YES];
您必须先注册笔尖。