UIImagePicker 上に自作のボタンを置きたい場合。
cameraOverView プロパティを使えばOKです。
- (void)pushButton { NSLog(@"push button!"); } - (void)showCamera { if ( ![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] ) { return; } UIImagePickerController* ipc = [UIImagePickerController new]; [ipc setSourceType:UIImagePickerControllerSourceTypeCamera]; [ipc setDelegate:self]; [ipc setAllowsEditing:NO]; [ipc setCameraFlashMode:UIImagePickerControllerCameraFlashModeOff]; UIButton *button = [UIButton buttonWithType:100]; [button setTitle:@"hoge" forState:UIControlStateNormal]; [button setFrame:CGRectMake(120, 120, 80, 80)]; // CGRectMake(x, y, width, height) [button addTarget:self action:@selector(pushedButton) forControlEvents:UIControlEventTouchUpInside]; ipc.cameraOverlayView = button; [UIView animateWithDuration:0.2f animations:^{ [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:ipc.view cache:NO]; } completion:^(BOOL finished){ [self presentViewController:ipc animated:NO completion:^{}]; } ]; }
参考
こちらの記事を参考にさせて頂きました。