Search code examples
iosuiviewuinavigationcontrolleruipinchgesturerecognizer

Subview resize to full screen


I have subview inside UINavigationcontroller rootview, what is the best way to animate and resize it to full screen? i'm using UIPinchGestureRecognizer for this subview and [UIView animateWithDuration] method, but the size of view doesn't change.


Solution

  • Do the following

    - (IBAction) didPinch:(UIButton*)button
    {
        UIView *yourView; //this is the view you want to expand
    
        [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
    
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:1];
        yourView.frame = [[UIApplication sharedApplication].windows.lastObject frame];
        [UIView commitAnimations];
    }