关于可移动Button的定制

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

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


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

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

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




posted @ 2012-12-10 15:39  沙影无痕  阅读(164)  评论(0编辑  收藏  举报