How can I animate zoom / zoom on iOS using Objective-C?

I want to replicate the zoom / zoom animation so common in iOS apps (example # 1 , # 2 ). I am specifically looking for a source that can provide some shared library with predefined values ​​for perfect animation. As for magnification, it must have pre-configured conversion values ​​that are easily identified by the human eye. Something like pop animation, etc.

I assume that they should be well supported in iOS with either a library or direct API support ... But I'm not sure where to start.

+4
source share
4 answers

What I was looking for when looking at the examples I gave was an abstraction layer that would give me the most commonly used types of animation.

Such types will allow the developer not only to include general animations, such as scaling / reduction, but also will include optimal animation values ​​(To, From, Timing, etc.) so that the developer does not have to worry about this.

I found one such library here , and I believe that there are many more.

+1
source

Use the following code to increase and decrease the animation.

For increase:

- (void)popUpZoomIn{ popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001); [UIView animateWithDuration:0.5 animations:^{ popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0, 1.0); } completion:^(BOOL finished) { }]; } 

To zoom out:

 - (void)popZoomOut{ [UIView animateWithDuration:0.5 animations:^{ popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001); } completion:^(BOOL finished) { popUpView.hidden = TRUE; }]; } 
+14
source

Similar animations can be performed without using third-party libraries.

Example:

  self.frame = CGRectMake(0.0f, 0.0f, 200.0f, 150.0f); [UIView beginAnimations:@"Zoom" context:NULL]; [UIView setAnimationDuration:0.5]; self.frame = CGRectMake(0.0f, 0.0f, 1024.0f, 768.0f); [UIView commitAnimations]; 

Scale Usage Example Also

  UIButton *results = [[UIButton alloc] initWithFrame:CGRectMake(5, 5, 100, 100)]; [results addTarget:self action:@selector(validateUserInputs) forControlEvents:UIControlEventTouchDragInside]; [self.view addSubview:results]; results.alpha = 0.0f; results.backgroundColor = [UIColor blueColor]; results.transform = CGAffineTransformMakeScale(0.1,0.1); [UIView beginAnimations:@"fadeInNewView" context:NULL]; [UIView setAnimationDuration:1.0]; results.transform = CGAffineTransformMakeScale(1,1); results.alpha = 1.0f; [UIView commitAnimations]; 

source: http://madebymany.com/blog/simple-animations-on-ios

+11
source

Applies to xCode 7 and iOS 9

  //for zoom in [UIView animateWithDuration:0.5f animations:^{ self.sendButton.transform = CGAffineTransformMakeScale(1.5, 1.5); } completion:^(BOOL finished){ }]; // for zoom out [UIView animateWithDuration:0.5f animations:^{ self.sendButton.transform = CGAffineTransformMakeScale(1, 1); }completion:^(BOOL finished){}]; 
+2
source

All Articles