如何在UIImagePickerController中将“相册”后退导航按钮自定义为“照片”?
我试试运气
任何想法如何自定义相册背面导航按钮。
UIImagePickerController *albumPicker = [[UIImagePickerController alloc]init];
[albumPicker setDelegate:self];
[albumPicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
popOverController = [[UIPopoverController alloc]initWithContentViewController:albumPicker];
[popOverController presentPopoverFromRect:CGRectMake(0,0,templatePhotoPlaceholderView.frame.size.height/2,templatePhotoPlaceholderView.frame.size.height) inView:templatePhotoPlaceholderView permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];
[popOverController setPopoverContentSize:CGSizeMake(320, 480)];
[albumPicker release];
我想自定义相册,照片已显示在图像中,已保存的照片显示为照片 怎么做我尝试它不适合我
答案 0 :(得分:7)
- (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;
}
这解决了问题的问题。
答案 1 :(得分:0)
您应该能够将此代码应用于您的控制器:
UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithTitle:@"Photo" style:UIBarButtonItemStyleBordered target:self action:@selector(buttonPressed:)];
self.navigationItem.leftBarButtonItem = btn; // or rightBarButtonItem
[btn release];
self是一个UIViewController - 还记得你需要为选择器设置action方法。
或者,您可以通过向下钻取控制器的按钮视图然后设置其标题来访问左/右按钮。
答案 2 :(得分:0)
[[UIBarButtonItem appearanceWhenContainedIn:[UIImagePickerController class], nil] setBackButtonBackgroundImage:[UIImage imageNamed:@"blank-button"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
后解决了我的问题,this讨论帮助我了解了ImagePicker类中的导航