Ios UIImagePickerController不';展示时,不要放在窗户里
我正在尝试开发一个简单的应用程序,它将与用户拍摄的照片一起工作。通过以下操作,我使用UIImagePickerController拍摄快照。我有一个带有单个空视图控制器的基本应用程序,在ViewDidAspect方法中,我执行以下操作:Ios UIImagePickerController不';展示时,不要放在窗户里,ios,iphone,objective-c,uiimagepickercontroller,Ios,Iphone,Objective C,Uiimagepickercontroller,我正在尝试开发一个简单的应用程序,它将与用户拍摄的照片一起工作。通过以下操作,我使用UIImagePickerController拍摄快照。我有一个带有单个空视图控制器的基本应用程序,在ViewDidAspect方法中,我执行以下操作: - (void)viewDidAppear:(BOOL)animated { if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCa
- (void)viewDidAppear:(BOOL)animated
{
if ([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera] == NO)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Error" message: @"Can't use the camera!" delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
return;
}
UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;
cameraUI.allowsEditing = NO;
cameraUI.delegate = self;
[self presentViewController: cameraUI animated: YES completion:NULL];
}
生成的视图类似于:
正如您所看到的,前后摄像头更改按钮没有完全显示,UIImagePickerController不适合屏幕。我是应该在演示前重新调整大小,还是我做了一些不正确的事情?您正在ipad上运行iphone target。在iphone上运行它可以解决你的问题不,我正在实际的iPad上运行它,但该应用程序是为iphone设计的。如果该应用程序只为iphone设计,那么它在ipadcamera中就无法完美运行。Camera不在模拟器上运行,所以他一定不能在模拟器上运行它,或者如果它只为iphone设计,就在iphone中运行它。它会起作用的