[IOS UI advanced, iosui advanced

Source: Internet
Author: User

[IOS UI advanced, iosui advanced
1. UIView transition Animation
 

1 // 2 // ViewController. m 3 // UIViewAnimationTest 4 // 5 // Created by hellovoidworld on 15/1/16. 6 // Copyright (c) 2015 hellovoidworld. all rights reserved. 7 // 8 9 # import "ViewController. h "10 11 @ interface ViewController () 12 13 @ property (nonatomic, strong) UIImageView * imageView; 14 @ property (nonatomic, assign) int imageIndex; 15 16 @ end17 18 @ implementation ViewController19 20-(void) viewDidLoad {21 [super viewDidLoad]; 22 // Do any additional setup after loading the view, typically from a nib.23 24 UIImageView * imageView = [[UIImageView alloc] initWithFrame: CGRectMake (80,100,160,240)]; 25 imageView. image = [UIImage imageNamed: @ "1"]; 26 self. imageView = imageView; 27 28 [self. view addSubview: imageView]; 29 30} 31 32-(void) touchesBegan :( NSSet *) touches withEvent :( UIEvent *) event {33 self. imageIndex ++; 34 if (self. imageIndex = 3) {35 self. imageIndex = 0; 36} 37 38 // specifies the control and content of the animation to be converted. 39 [UIView transitionWithView: self. imageView duration: 1.0 options: UIViewAnimationOptionTransitionFlipFromTop animations: ^ {40 self. imageView. image = [UIImage imageNamed: [NSString stringWithFormat: @ "% d", self. imageIndex + 1]; 41} completion: nil]; 42 43} 44 @ end

 

    2. Replacing view animation with UIView
1 2 // view3 with animation replacement [UIView transitionFromView: self. view toView: self. imageView duration: 1.0 options: UIViewAnimationOptionTransitionFlipFromTop completion: nil];

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.