OSX Fullscreen-like animation effect?

Discussion in 'iOS Programming' started by printz, Oct 16, 2013.

  1. printz macrumors regular

    Dec 23, 2012
    Is it possible to implement this effect in iOS? Make a view zoom in until it fills the whole screen, while the containing view slides to the left.
  2. Duncan C macrumors 6502a

    Duncan C

    Jan 21, 2008
    Northern Virginia
    Yes, it should be fairly simple using UIView animation.

    You will probably need to add a container view for everything that you want to slide left, and put your view that you want to zoom to fill the screen outside of that container view, so the expanding view doesn't shift left with everything else.

    Then you'd use code something like this:

    [UIView animateWithDuration: .2 
          #if K_ANIMATE_FRAME
            //Note that changing the frame will only work if the view redraws itself at the 
            //new size. UIImageView can be set up that way, 
            //but other view types may not.
            viewToExpand.frame = containerView.frame;  
            //An alternate approach is to apply a scale to the view's transform:
            CGFloat scale = containerView.frame.size.width / 
            viewToExpand.transform = CGAffineTransformMakeScale(scale, scale);
          //Now animate the container view off-screen
          CGPoint center = containerView.center;
          //Shift the container view left.
          center.x -= containerView.bounds.size.width; 
          containerView.center = center;

Share This Page