zoukankan      html  css  js  c++  java
  • ios7.1后setting中没有开启相机服务应用程序相机预览黑屏问题

    if ( [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0){
                    
                    //check whether the permission open for user in settings
                    AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
                    if (authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied)
                        
                    {
                        CMAlertView *alert = [[CMAlertView alloc]init];
                        [alert setAlertViewFrameWithX:self.localView.frame.size.width/8 withY:self.localView.bounds.size.height/2 withW:self.localView.frame.size.width - self.localView.frame.size.width/4 withH:100];
                        [alert setImage:@"01_login_alerticon@2x.png" withOrignalx:20 withY:30 withW:30 withH:30];
                        [alert setLabelWithText:NSLocalizedStringFromTable(@"alert_view_please_open_camera_visit_permission", @"StringInfo", nil) withX:50 withY:15 withW:180 withH:50];
                        [alert setFont:[UIFont systemFontOfSize:18.0f] withColor:[UIColor whiteColor]];
                        [alert setAlertViewBackgroundColor:[UIColor colorWithRed:68/255.0f green:153/255.0f blue:181/255.0f alpha:1.0]];
                        [alert setAlertViewDisplayType:@"Info"];
                        [alert show];
                        [alert release];
                        
                    }
                    else{
                        //present the camera view
                        UIImagePickerController *picker = [[UIImagePickerController alloc] init];//initial
                        self.imagePickerController = picker;
                        [picker release];
                        self.imagePickerController.delegate = self;
                        self.imagePickerController.allowsEditing = YES;//set editable
                        if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
                            self.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
                            
                        }else{
                            
                            self.imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
                            
                            
                        }
                        [self presentViewController:self.imagePickerController animated:YES completion:nil];//enter camera
                    }

  • 相关阅读:
    sqlserver2012附加数据库2005版本时出现的问题
    jQuery实现评论还剩多少个字
    在mvc3中经常使用身份验证实现
    Windows Phone学习(1):棋子未动,先观全局
    使用jquery.pagination.js实现无刷新分页
    Javascript和JQuery中常用的随机数产生函数(很好用)
    网页打印样式设置(页眉,页脚,页边距)
    rdlc到设置宽度后自动换行(转)
    VSS忘记Admin密码和修改默认登陆用户
    解决jquery 修改onclick事件后IE兼容模式下立刻执行的问题
  • 原文地址:https://www.cnblogs.com/lisa090818/p/3891907.html
Copyright © 2011-2022 走看看