可能有更好的方法来做到这一点,如果有请指导我。
我正在创建一个UIImagePickerController在 viewDidAppear 中使用 overrideView 来表示“从库中选择”、“拍照”、“闪光灯”、“相机源”等。
// Set up the camera
imagePicker = [[UIImagePickerController alloc]
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
imagePicker.cameraOverlayView = [self cameraOverlayView];
cameraOverlayView.backgroundColor = [UIColor clearColor];
imagePicker.showsCameraControls = NO;
imagePicker.toolbarHidden = YES;
imagePicker.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:imagePicker animated:YES];
然后,我有一个 IBAction 调用我的“从库函数中选择”,加载另一个 UIImagePickerController 以从设备中选择照片。
- (IBAction)library:(id)sender
{
UIImagePickerController *libraryPicker = [[[UIImagePickerController alloc] init] autorelease];
libraryPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
libraryPicker.delegate = self;
[self.imagePicker presentModalViewController:libraryPicker animated:YES];
}
当出现“从库中选择”模式时,我会在顶部看到一个大约状态栏大小的白色条。我知道这与在模态之上叠加模态有关,但我不知道如何解决它。 (即,我的“拍照”视图布局导航良好,尽管不显示额外的“从库中选择”模式)。
有任何想法吗?任何帮助或指导将不胜感激!
Try
[self presentModalViewController:libraryPicker animated:YES];
代替
[self.imagePicker presentModalViewController:libraryPicker animated:YES];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)