更改导航栏UIImagePickerController的标题
问题描述:
我想知道如何更改UIImagePickerController的导航栏标题。我尝试了几种方法,但无法做到。更改导航栏UIImagePickerController的标题
试过follwing方式,
imgPicker.title = [NSString stringWithString:@"My Name"];
imgPicker.navigationItem.title = [NSString stringWithString:@"My Name"];
但它仍然给了我所谓的“相册”。可有人默认标题请告诉我该怎么办呢?....
感谢。 ...
答
我找到了办法。当你将你的UIImagePickerController委托设置为self并且实现它的工作方式如下。
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[viewController.navigationItem setTitle:@""];
}
从这个链接http://forums.macrumors.com/showthread.php?t=533216
谢谢...
答
这应该允许您设置标题发现(以前的答案有一个错字):
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[viewController.navigationItem setTitle:@"Choose A Photo"];
}
答
斯威夫特
IOS 8 || 9
func navigationController(navigationController: UINavigationController, willShowViewController viewController: UIViewController, animated: Bool)
{
viewController.navigationItem.title = "video" // Change title
imagePicker.navigationBar.tintColor = .whiteColor() //Text Color
imagePicker.navigationBar.titleTextAttributes = [
NSForegroundColorAttributeName : UIColor.whiteColor()
]
}
这应该是'[viewController.navigationItem的setTitle:@ “”];' – OlivaresF 2011-06-03 20:01:10
只要编辑。感谢OlivaresF。 – 2012-01-30 06:52:40