【发布时间】:2017-12-10 09:57:15
【问题描述】:
我有一个视图,我想根据用户的选择展示 UIImagePicker 相机或照片。但是当我展示我的选择器控制器时,我的导航栏是黑色的,并且出现了一个奇怪的白色背景而不是标签。
相机用
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
[[picker navigationBar] setTintColor:[UIColor whiteColor]];
picker.modalPresentationStyle = UIModalPresentationCurrentContext;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls = YES;
picker.delegate = self;
//[picker setAllowsEditing:YES];
[self.delegate presentViewController:picker animated:YES completion:nil];
用于相册中的照片选择器
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
[[picker navigationBar] setTintColor:[UIColor whiteColor]];
// picker.modalPresentationStyle = UIModalPresentationCurrentContext;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
//picker.showsCameraControls = YES;
picker.delegate = self;
//[picker setAllowsEditing:YES];
[self.delegate presentViewController:picker animated:YES completion:nil];
这是我尝试从照片(图库)中提取时的图像
他们有这个奇怪的导航栏,我猜当我们展示一个pickerViewController 时,它通常被ImagePicker 取代。
【问题讨论】:
-
您是否尝试过使用 [self presentViewController:picker animated:YES completion:nil] 呈现 UIImagePickerController。请删除 self.delegate 并检查。
-
不,它不起作用。
标签: ios objective-c uiimagepickercontroller