1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| @interface ViewController () @property (weak, nonatomic) IBOutlet UIImageView *imageView; @property (nonatomic,assign)int index; @end
- (void)viewDidLoad { [super viewDidLoad]; _index=1; } -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { _index++; if (_index==4) { _index=1; } NSString *fileName=[NSString stringWithFormat:@"%d",_index]; _imageView.image=[UIImage imageNamed:fileName]; [UIView transitionWithView:_imageView duration:0.5 options:UIViewAnimationOptionTransitionCurlUp animations:nil completion:nil]; }
|