您的位置:首页 > 产品设计 > UI/UE

IOS UIView(UIButton)通过显示动画移动的时候 响应点击的解决方案

2014-08-04 09:34 579 查看
今天在做一个UIButton显示动画的时候,遇到一个问题,就是在移动的时候 ,需要相应它的点击时间(click)
通过CAKeyframeAnimation 来移动UIButton的layer ,效果可以,但是就是无法点击。

解决方法:
将UIButton 的 userinterfaceenable 设置为NO
为UIButton的父view添加tap点击事件
点击事件实现如下
-(void)viewClicked:(UITapGestureRecognizer*)gesture
{
CGPoint touchPoint = [gesture locationInView:_bgImgView];

NSLog(@"pt:%f %f",touchPoint.x,touchPoint.y);

if ([ btn.layer.presentationLayer hitTest:touchPoint])
{
}
}

本文转自 张江论坛 http://www.999dh.net/home.php?mod=space&uid=1&do=blog&id=410 转载请注明,谢谢~~~~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: