如何给UIImagePickerController中的标题?
我想给图像屏幕截图中显示的UIImagePickerController
标题
将UIImagePickerController
委托设置为self并实现以下UINavigationControllerDelegate
方法:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { [viewController.navigationItem setTitle:@"<Your-Title>"]; }
你试试这个代码:
- (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; }
你需要在Swift中实现UINavigationController
的委托方法:
func navigationController(navigationController: UINavigationController, willShowViewController viewController: UIViewController, animated: Bool) { viewController.navigationItem.title = "Some title" }