现在的位置: 首页 > 综合 > 正文

关于可移动Button的定制

2017年12月09日 ⁄ 综合 ⁄ 共 294字 ⁄ 字号 评论关闭

在开发的过程中,有时候需要用到可以移动的Button,这就需要自己去写一个了;

设计思路:通过重写几个touch方法

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    if (!isMove && !isCancelTouch) {
        [delegate clickedActionOfScreenButton];
    }
}

当没有移动及没有取消的时候视为单击,当然依据需要还可以 判断触摸开始到结束的时间进行限制;

for(UITouch *touch in event.allTouches){
      float time = touch.timestamp;
}

抱歉!评论已关闭.