使用.xib文件作为自定义相机覆盖视图

问题描述:

我使用.xib文件创建了CameraOverlayViewController,以实现自定义相机overlayView。该OverlayView的只是一个透明背景的按钮,选择从photoLibrary照片,并在mainViewController用下面的代码加载成功:使用.xib文件作为自定义相机覆盖视图

CameraOverlayViewController* overlay = [[CameraOverlayViewController alloc] initWithNibName:@"CameraOverlayViewController" bundle:nil]; 
cameraPicker.cameraOverlayView = overlay.view; 

然而,当我按下了cameraOverlayView按钮没有任何反应。没有错误信息,没有。有人知道这里发生了什么吗?以下是我在CameraOverlayViewController文件中的代码:

- (IBAction)select:(UIButton *)sender { 

    UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
    [self dismissViewControllerAnimated:YES completion:^{ 

     [self presentViewController:picker 
          animated:YES completion:nil]; 

    }]; 
    picker.delegate = self; 
    picker.allowsEditing = YES; 
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 

    [self presentViewController:picker animated:YES completion:NULL]; 
    NSLog(@"Just work alrdy!!!"); 
} 

在此先感谢!

试试这个..

-(IBAction)select:(UIButton *)sender { 

    UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
    picker.delegate = self; 
    picker.allowsEditing = YES; 
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
    [self dismissViewControllerAnimated:YES completion:^{ 

    [self presentViewController:picker 
         animated:YES completion:nil]; ////////check this is called?????? 

    }]; 
}