ios – 当我为UIImageView设置动画时,UITapGestureRecognizer不起作用

ios – 当我为UIImageView设置动画时,UITapGestureRecognizer不起作用,第1张

概述当我想为UI ImageView设置动画时,添加到它的UITapGestureRecognizer无法工作.为什么??? -(void) testTap:(id)sender { NSLog(@"Test tap...");}-(void) testSlide { UITapGestureRecognizer* testTap = [[[UITapGestureRecogni 当我想为UI ImageVIEw设置动画时,添加到它的UITapGestureRecognizer无法工作.为什么???
-(voID) testTap:(ID)sender {    NSLog(@"Test tap...");}-(voID) testSlIDe {    UITapGestureRecognizer* testTap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(testTap:)] autorelease];    testTap.numberOfTapsrequired = 2;    UIImageVIEw* imageVIEw = [[[UIImageVIEw alloc] initWithImage:[UIImage imagenamed:@"tip_slIDe"]] autorelease];    [imageVIEw setFrame:CGRectMake(40,40,200,200)];    imageVIEw.userInteractionEnabled = YES;    imageVIEw.multipletouchEnabled = YES;    [imageVIEw addGestureRecognizer:testTap];    [self.vIEw addSubvIEw:imageVIEw];    // When I add the following code,the UITapGestureRecognizer will not work. WHY???    imageVIEw.Alpha = 0;    CGAffinetransform t = imageVIEw.transform;    if (CGAffinetransformIsIDentity(t)) {        UIVIEwAnimationoptions options = UIVIEwAnimationCurveEaseInOut;        [UIVIEw animateWithDuration:1.0 delay:0 options:options animations:^{            imageVIEw.Alpha = 1.0;        } completion:^(BOol finished) {            if (finished) {                [UIVIEw animateWithDuration:1.0 delay:2.0 options:options animations:^{                imageVIEw.Alpha = 0.4;                } completion:^(BOol finished) {                    if (finished) {                        [imageVIEw removeFromSupervIEw];                    }                }];            }        }];    }}
解决方法 您需要在动画期间允许用户交互.
UIVIEwAnimationoptions options = UIVIEwAnimationCurveEaseInOut | UIVIEwAnimationoptionAllowUserInteraction;
总结

以上是内存溢出为你收集整理的ios – 当我为UIImageView设置动画时,UITapGestureRecognizer不起作用全部内容,希望文章能够帮你解决ios – 当我为UIImageView设置动画时,UITapGestureRecognizer不起作用所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1108964.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存