iphone – 如何在UINavigationController的RootViewController上
发布时间:2020-12-14 19:50:47 所属栏目:百科 来源:网络整理
导读:这是我的代码我想在打开的rootviewController上放一个后退按钮. - (void)selectSurah:(id)sender { SurahTableViewController * surahTableViewController = [[SurahTableViewController alloc] initWithNibName:@"SurahTableViewController" bundle:nil]; s
这是我的代码我想在打开的rootviewController上放一个后退按钮.
- (void)selectSurah:(id)sender { SurahTableViewController * surahTableViewController = [[SurahTableViewController alloc] initWithNibName:@"SurahTableViewController" bundle:nil]; surahTableViewController.navigationItem.title=@"Surah"; surahTableViewController.navigationItem.backBarButtonItem.title=@"Back"; UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:surahTableViewController]; [self presentModalViewController:aNavigationController animated:YES]; } 解决方法
我不相信有可能从导航堆栈中弹出根视图控制器,但是您可以使用添加为UIBarButtonItem的自定义视图的UIButton伪造它:
UIButton *b = [[UIButton alloc]initWithButtonType:UIButtonTypeCustom]; [b setImage:[UIImage imageNamed:@"BackImage.png"] forState:UIControlStateNormal]; [b addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside]; self.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:b]; 适合iOS UI元素的PSD可以找到here. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |