How to give Title in UIImagePickerController?

2019-08-08 06:09发布

I want to title in image crop view i want to give title in <code>UIImagePickerController</code> like following image screen shot.

I want to give title in UIImagePickerController as shown in image screen shot

3条回答
放我归山
2楼-- · 2019-08-08 06:54

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>"];
}
查看更多
冷血范
3楼-- · 2019-08-08 07:03

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"
}
查看更多
男人必须洒脱
4楼-- · 2019-08-08 07:07

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;
}
查看更多
登录 后发表回答