gpt4 book ai didi

ios - 关闭 UIImagePickerController 后推送 UIView Controller

转载 作者:行者123 更新时间:2023-11-29 13:01:49 26 4
gpt4 key购买 nike

我有 UIViewControllerUIToolBar
UIToolBar 有三个按钮 [options,pickphotofromlibrary,camera].

当用户按下相机按钮时,他们将被带到自定义相机界面[覆盖]。

代码:

- (void)showImagePickerForSourceType:(UIImagePickerControllerSourceType)sourceType

{
if (self.imageView.isAnimating)
{
[self.imageView stopAnimating];
}

UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = sourceType;
imagePickerController.delegate = self;

if (sourceType == UIImagePickerControllerSourceTypeCamera)
{
/*
The user wants to use the camera interface. Set up our custom overlay view for the camera.
*/
imagePickerController.showsCameraControls = NO;

/*
Load the overlay view from the OverlayView nib file. Self is the File's Owner for the nib file, so the overlayView outlet is set to the main view in the nib. Pass that view to the image picker controller to use as its overlay view, and set self's reference to the view to nil.
*/
[[NSBundle mainBundle] loadNibNamed:@"overlayView" owner:self options:nil];
self.overlayView.frame = imagePickerController.cameraOverlayView.frame;
imagePickerController.cameraOverlayView = self.overlayView;
self.overlayView = nil;
}


[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];



self.imagePickerController = imagePickerController;

[self.navigationController presentViewController:self.imagePickerController animated:YES completion:nil];

因此,当用户拍照时,我需要推送另一个向他们显示表格 View 的 View 。我已经创建了一个 nib 文件,但不知道如何继续。

任何帮助将不胜感激..

最佳答案

您需要使用以下 UIImagePickerController 的委托(delegate)方法

#pragma mark -
#pragma mark - UIImagePickerController Delegate Method

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// This code is for dismiss your UIImagePickerController
[self dismissViewControllerAnimated:YES completion:nil];

//And then write code of your Next ViewController

}

关于ios - 关闭 UIImagePickerController 后推送 UIView Controller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19589501/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com