【发布时间】:2014-08-05 20:01:51
【问题描述】:
我正在做的事情在模拟器和我的 iPad2 上都有效,我没有遇到任何问题,但这不是记录在案的做事方式,所以我担心它可能不适用于较新的 iPad。
我有 UIButtons 可以区分触摸和长按。
按钮的构造与往常一样,有目标和动作,没有手势。
- (IBAction)buttonAction:(id)sender forEvent:(UIEvent*)event
{
UIButton *button=(UIButton *)sender;
bool longpress=NO;
UITouch *touch=[[[event allTouches] allObjects] objectAtIndex:0];
if(touch.tapCount==0) longpress=YES;
switch(button.tag)
{
case TAG:
{
if(longpress)
{
... do longpress thing
}
else
{
... do regular touch thing
}
break;
}
...
}
}
【问题讨论】:
标签: ios objective-c uibutton long-press