我有一面图像墙 ( UIScrollView
),里面有很多UIImageView's
.
这是我的代码:
for (ThumbPosterModel *tPoster in _thumbsPosterStack) {
UIImageView *imageView = [[UIImageView alloc] initWithImage:tPoster.thumb];
imageView.userInteractionEnabled = YES;
imageView.frame = CGRectMake(i, imageView.frame.origin.y, imageView.frame.size.width, imageView.frame.size.height);
[tPoster setTag:tag];
[_posterTagArr addObject:(BasicPosterModel*)tPoster];
imageView.tag = tag;
tag++;
[posterWallScrollView addSubview:imageView];
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageDoubleTapped:)];
doubleTap.numberOfTapsRequired = 2;
[imageView addGestureRecognizer:doubleTap];
}
这是我的 IBAction:
-(IBAction)imageDoubleTapped:(id)sender {
NSInteger selectTag = (((UIGestureRecognizer*)sender).view.tag);
for (BasicPosterModel *bPoster in _posterTagArr) {
if(bPoster.tag == selectTag) {
[UIView transitionFromView:(UIImageView*)((UIGestureRecognizer*)sender).view
toView:mySecordView //let's say next ImageView. Doesn't matter
duration:1.0
options:UIViewAnimationOptionTransitionCrossDissolve
completion:^(BOOL finished) {
// animation completed
}];
}
}
}
当我使用时:
UIViewAnimationOptionTransitionCrossDissolve
这仅对我在 ScrollView 中的图像有影响。当我在这段代码中使用 UIViewAnimationOptionTransitionFlipFromTop
这会影响我的滚动视图。
怎么可能?
当然,我希望我的动画效果只适用于单个图像。