我创建了一个带有.xib文件的CameraOverlayViewController来实现自定义的相机overlayView。 overlayView只是一个透明背景,带有一个按钮,用于从photoLibrary中选择照片,并使用以下代码在mainViewController中成功加载:
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!!!");
}
提前致谢!
答案 0 :(得分:0)
试试这个..
-(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??????
}];
}