Skip to content

长按增加或者减少按钮的timer间隔时间过短,用户单击时经常出现+2或-2的情况,TimeInterval加长到0.2能有效的避免这种情况 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PPNumberButton/PPNumberButton/PPNumberButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ - (void)touchDown:(UIButton *)sender

if (sender == _increaseBtn)
{
_timer = [NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(increase) userInfo:nil repeats:YES];
_timer = [NSTimer scheduledTimerWithTimeInterval:0.2f target:self selector:@selector(increase) userInfo:nil repeats:YES];
}
else
{
_timer = [NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(decrease) userInfo:nil repeats:YES];
_timer = [NSTimer scheduledTimerWithTimeInterval:0.2f target:self selector:@selector(decrease) userInfo:nil repeats:YES];
}
[_timer fire];
}
Expand Down