【发布时间】:2016-02-20 12:27:53
【问题描述】:
我已经实现了以下操作并打开了相机但应用程序崩溃了,有时打开并拍照时应用程序崩溃并且日志仅显示“对未渲染的视图进行快照会导致空快照。确保您的视图在快照或屏幕更新后的快照之前已至少渲染一次收到内存警告。”
我用于从图库中获取图像及其工作的相同功能。
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex: (NSInteger)buttonIndex{
if (buttonIndex==0) {
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Alert"
message:@"Device has no Camera!"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[myAlertView show];
}else{
[self performSelector:@selector(loadCamera) withObject:nil afterDelay:1.0];
}
}
}
-(void)loadCamera{
picker1 = [[UIImagePickerController alloc] init];
picker1.delegate = self;
picker1.allowsEditing=YES;
picker1.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker1 animated:YES completion:NULL];
}
谁能帮忙。
【问题讨论】:
-
请参考:我认为它很有帮助Open Camera in ios
-
CJ 现在你得到解决方案了吗?
-
你试过下面的答案了吗?如果没有,告诉我。
-
我使用了下面的,但应用程序仍然崩溃并且还使用它的代表 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
-
我在 actionsheet 动作下调用这个相机功能。这有什么问题吗?
标签: ios objective-c uiimagepickercontroller ios-camera