-(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不起作用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)