Using animations in iOS Application can make it more impressive. A user always loves to use something new innovative things. There are few basic animations available in both Objective C & Swift by using that we can covert a normal user experience to something special.

It’s not necessary that it will make a vast difference in the application. Some of the users even do not notice such things. But at least that will make your application stand differently than the other similar application with just a few lines of codes.

Here are some basic animation techniques available which you can utilize into your application to make it different.

View Transition animations :

This will allow page curl animation while presenting new view controller.

For Presenting :

NextView *ivc = [mainstoryboard instantiateViewControllerWithIdentifier:@”nextview”];

[UIView transitionWithView:APP_DEL.window duration:0.5 options:UIViewAnimationOptionTransitionCurlUp animations:^{

}completion:nil];

[self presentViewController:ivc animated:NO completion:nil];

 

For Dismissing :

[UIView transitionWithView:APP_DEL.window duration:0.5 options:UIViewAnimationOptionTransitionCurlDown animations:^{

}completion:nil];

[self dismissViewControllerAnimated:NO completion:nil];

 

Here are the more transition animations available which you can use in place of curl animations :

UIViewAnimationOptionTransitionFlipFromLeft    = 1 << 20,

UIViewAnimationOptionTransitionFlipFromRight   = 2 << 20,

UIViewAnimationOptionTransitionCurlUp          = 3 << 20,

UIViewAnimationOptionTransitionCurlDown        = 4 << 20,

UIViewAnimationOptionTransitionCrossDissolve   = 5 << 20,

UIViewAnimationOptionTransitionFlipFromTop     = 6 << 20,

UIViewAnimationOptionTransitionFlipFromBottom  = 7 << 20,

 

View animations with completion :

This is simple view frame animation which allows you to move view through out the animation. It will used to open view with moving animation.

view.frame = CGRectMake(0, 0, 0, 0);

[UIView animateWithDuration:0.7 animations:^{

view.frame = CGRectMake(0, 0, 375, 667);

} completion:^(BOOL finished) {

// On completion show objects on view

}];

 

This is simple view frame animation which allows you to show view with blink effect.

view.alpha = 0.0;

[UIView animateWithDuration:0.7 animations:^{

view.alpha = 1.0;

} completion:^(BOOL finished) {

// On completion show objects on view

}];

More animation methods can be used with few more features :

  • (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^ __nullable)(BOOL finished))completion NS_AVAILABLE_IOS(4_0);
  • (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations NS_AVAILABLE_IOS(4_0); // delay = 0.0, options = 0,
  • (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay usingSpringWithDamping:(CGFloat)dampingRatio initialSpringVelocity:(CGFloat)velocity options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^ __nullable)(BOOL finished))completion NS_AVAILABLE_IOS(7_0);
Share
Share