I want to give title in UIImagePickerController
as shown in image screen shot
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Set UIImagePickerController
delegate to self and implement the following method of UINavigationControllerDelegate
:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[viewController.navigationItem setTitle:@"<Your-Title>"];
}
回答2:
You try this code:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
UINavigationItem *ipcNavBarTopItem;
// add done button to right side of nav bar
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Photos"
style:UIBarButtonItemStylePlain
target:self
action:@selector(saveImages:)];
UINavigationBar *bar = navigationController.navigationBar;
[bar setHidden:NO];
ipcNavBarTopItem = bar.topItem;
ipcNavBarTopItem.title = @"Photos";
ipcNavBarTopItem.rightBarButtonItem = doneButton;
}
回答3:
You need to implement the delegate method for UINavigationController
, in Swift:
func navigationController(navigationController: UINavigationController, willShowViewController viewController: UIViewController, animated: Bool) {
viewController.navigationItem.title = "Some title"
}