本文主要是介绍调用UIview封装的动画,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
代码如下:
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property(nonatomic , assign) int index ;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
self.index ++;
if (self.index == 12) {
self.index = 1;
}
NSString * imageString = [NSString stringWithFormat:@"%d.jpg",self.index +1 ];
self.iconImageView.image = [UIImage imageNamed:imageString];
//调用UIview的封装
[UIView transitionWithView:self.iconImageView duration:1 options:UIViewAnimationOptionTransitionFlipFromTop animations:nil completion:^(BOOL finished) {
NSLog(@"动画完毕");
}];
/**
*从那个视图转场到哪个是视图
**/
//[UIView transitionFromView:self.view toView:self.iconImageView duration:1 options:UIViewAnimationOptionTransitionFlipFromTop completion:nil];
}
@end
这篇关于调用UIview封装的动画的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!