【发布时间】:2014-06-11 12:36:37
【问题描述】:
我的代码可以在 iPad 上完美运行
self.clockInEmployee = nil;
self.clockInEmployee = [[userInfo userInfo] valueForKey:@"employee"];
self.clockInEmployeeRole = [[userInfo userInfo] valueForKey:@"role"];
CLog (@"PIN %@", self.clockInEmployee.pin);
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = (id)self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls = YES;
picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
picker.cameraOverlayView = self.cameraOverlay.view;
if (isPhone())
{
picker.view.frame = CGRectMake(0, 748, 1024, 748);
[mainNavController.view addSubview:picker.view];
[UIView animateWithDuration:0.5 animations:^{
picker.view.frame = CGRectMake(0, 0, 1024, 748);
} completion:^(BOOL finished){
[picker viewDidAppear:YES];
}];
}
modViewController = picker;
但在 iPhone 上尝试启动相机时,我只观察到黑屏。
但如果我尝试这样启动它:
[appPresentingViewController presentViewController:picker animated:YES completion:nil];
成功启动。但在我的特定项目中,它会导致一些 UI 问题,因此无法使用。
我怎样才能做到这一点
if (isPhone())
{
picker.view.frame = CGRectMake(0, 748, 1024, 748);
[mainNavController.view addSubview:picker.view];
[UIView animateWithDuration:0.5 animations:^{
picker.view.frame = CGRectMake(0, 0, 1024, 748);
} completion:^(BOOL finished){
[picker viewDidAppear:YES];
}];
}
适用于 iPad 和 iPhone 吗?
【问题讨论】: