【发布时间】:2012-08-07 14:05:10
【问题描述】:
我有一面图片墙 (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 这是 ONLY 对我在 ScrollView 中的图像的影响。
当我在此代码中使用UIViewAnimationOptionTransitionFlipFromTop 时,这会影响我的滚动视图。
这怎么可能?
当然我希望我的动画效果只适用于单个图像。
【问题讨论】:
-
您确定您使用的是 iOS>=5 吗?
-
不,我的目标是 iOS 4.3。但是
transitionFromView:toView:..在 iOS >=4.0 中可用 -
但 UIViewAnimationOptionTransitionFlipFromTop 自 iOS 5.0 起才可用,请参阅我的答案和链接)
-
但是使用 `UIViewAnimationOptionTransitionCurlUp' 我得到了同样的错误
-
我仍然认为较小的容器视图可以解决您的问题(请参阅下面的答案)。您能否向我们展示您尝试过但不起作用的代码?
标签: ios objective-c uiviewanimation uiviewanimationtransition uiviewanimation-curve