Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 单击按钮时不拍照_Ios_Objective C_Uiimagepickercontroller - Fatal编程技术网

Ios 单击按钮时不拍照

Ios 单击按钮时不拍照,ios,objective-c,uiimagepickercontroller,Ios,Objective C,Uiimagepickercontroller,我想用自定义按钮拍照。MyOverLayViewController是我的控制器,上面有一个按钮,用于执行动作拍照,但它们不单击。并在该行显示警告: 从不可移植指针OverlayViewcontroller strong imagePicker.delegate=overlay分配id nullabel 在类OverLayViewController中是否采用UIImagePickerController委托协议?在类OverLayViewController中是否采用UIImagePicker

我想用自定义按钮拍照。My
OverLayViewController
是我的控制器,上面有一个按钮,用于执行动作拍照,但它们不单击。并在该行显示警告:

从不可移植指针OverlayViewcontroller strong imagePicker.delegate=overlay分配id nullabel


在类OverLayViewController中是否采用UIImagePickerController委托协议?在类OverLayViewController中是否采用UIImagePickerController委托协议?
- (void)takePicture
{
    imagePicker=[[UIImagePickerController alloc]init];
    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
    imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
    imagePicker.showsCameraControls = NO;
    imagePicker.navigationBarHidden = YES;
    imagePicker.toolbarHidden = YES;
    imagePicker.wantsFullScreenLayout = YES;;

    OverLayViewController * overlay =[[OverLayViewController alloc]initWithNibName:@"OverLayViewController" bundle:nil];

    overlay.pickerrefrence = imagePicker;
    imagePicker.cameraOverlayView = overlay.view;
    imagePicker.delegate = overlay;
    [self.view bringSubviewToFront:overlay.view];

    [overlay.button addTarget:self action:@selector(takePicture) forControlEvents:UIControlEventTouchUpInside];
    [self presentViewController:imagePicker animated:YES completion:nil];            
}