Quantcast
Channel: specialeffects Feed
Viewing all articles
Browse latest Browse all 3

How to Resize UIView using Core Animation in iOS?

$
0
0

Core Animation based on Quartz provides very simple ways to create special effects in your game or application.

The following shows how to create a Resize Effect of any UIView (e.g. UIButtonView, UIImageView etc.)

  1. +(void)resize:(UIView*)view to:(CGSize)size withDuration:(int) duration andSnapBack:(BOOL) snapBack
  2. {
  3.     // Prepare the animation from the old size to the new size
  4.     CGRect oldBounds = view.layer.bounds;
  5.     CGRect newBounds = oldBounds;
  6.     newBounds.size = size;
  7.     CABasicAnimation *animation =[CABasicAnimation animationWithKeyPath:@"bounds"];
  8.    

Viewing all articles
Browse latest Browse all 3

Trending Articles