开发者

Change modal UIImagePickerController parent view

I'm trying to build an app that features a button on the first view, when you tap the button it presents the UIImagePickerController modal view. What I would ideally like is once you have taken you photo, when the modal view is dismissed, the original view which presented the image picker changes.

For example, the process would be VIEW 1 -- (tap button) --> MODAL IMAGE PICKER -- (close modal view) --> VIEW 2.

So far I've got the app loading the UIImagePickerController and once you are complete, within the didFinishPickingMediaWithInfo delegate method, it sets a 开发者_JAVA百科BOOL value to YES and then within the ViewDidAppear of my original view (VIEW 1) it then presents a new modal with the next view.

The problem with this is that there is a delay between the closing the modal view and the next view (VIEW 2) appearing.

Does anyone know if the above is possible? If not, I might have to resort to displaying a spinner and saying "Processing image" between the image picker closing and the second view appearing.


You can use a navigation controller to solve this problem.

Create a navigation controller and push your first controller into it. Later from your first controller, present the picker modally. Pretty much the same until now except that we have added a navigation controller. This is what I did to get your desired result.

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    NewController *controller = [[NewController alloc] initWithNibName:nil bundle:nil];
    [self.navigationController pushViewController:controller animated:YES];
    [self dismissModalViewControllerAnimated:YES];
    [controller release];
}

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜