How to give Title in UIImagePickerController?

烈酒焚心 提交于 2019-12-11 12:15:40

问题


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"
}


来源:https://stackoverflow.com/questions/30295348/how-to-give-title-in-uiimagepickercontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!