What / How does an animation with a close aperture of UIImagePickerController start?

I use a custom overlay view and showsCameraControls = NO. When I finished, I missed the ModalViewControllerAnimated: YES. It seems that the iris seems to be completely closed (i.e., the closing animation is just a puff and it is closed), and then immediately goes down from the screen.

As a test, I manually call viewWillDisappear on the UIImagePickerController and create a closed iris, but again without smooth animation.

I also tried wrapping the dismissal in a long transaction of animation, and it just made the reappearance of the base navigation bar slow down. Iris behaved the same as above.

I do not want to make my own animation of irises - it will be awkward!

PS: Using sdk 4.0

+3
source share
1 answer

To partially answer my own question, the best I've been able to come up with so far is:

- (void)imagePickerController:(UIImagePickerController*)picker 
didFinishPickingMediaWithInfo:(NSDictionary*)info
{
    [picker viewWillDisappear:YES];

    [self performSelector:@selector(processPickerImage:) 
               withObject:[[info objectForKey:UIImagePickerControllerOriginalImage] retain] 
               afterDelay:0.1];
}

-(void) processPickerImage:(UIImage *)uiImage
{

    // do stuff
    [self dismissModalViewControllerAnimated:YES];
    // dismiss your custom overlay etc.
    [uiImage release];
}

In fact, it does not animate the aperture, but at least it is instantly displayed on the screen, so the user will know that the picture is being taken. I'm also not very happy that viewWillDisappear gets called twice in the UIImagePickerController - I'm not sure if it is guaranteed to be safe.

It also displays a status bar above the iris, which is annoying.

I hope someone has a better solution?

0
source

Source: https://habr.com/ru/post/1761100/


All Articles