Skip to content

hxsxyz/QiButton_EventInterval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QiButton_EventInterval

控制UIButton的点击间隔时间的方法

思路简介

1、创建一个UIButton的类别,使用runtime为UIButton增加public属性qi_eventInterval和private属性eventUnavailable。
2、在+load方法中使用runtime将UIButton的-sendAction:to:forEvent:方法与自定义的-qi_sendAction:to:forEvent:方法交换Implementation。
3、使用qi_eventInterval作为控制eventUnavailable的计时因子,用eventUnavailable开控制UIButton的event事件是否有效。

使用方法

UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
/* here is some button's configuration codes */
[self.view addSubview:button];
    
//! 设置按钮的点击响应间隔时间
button.qi_eventInterval = 2.0;

实现效果

01

About

控制UIButton的点击间隔时间的方法

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published