iOS如何避免对多个按钮同时多点触摸
答: 设置所有UIButton的ExclusiveTouch属性为YES
如何设置?
-(
void
)setExclusiveTouchForButtons:(UIView *)myView
{
for
(UIView * v in [myView subviews]) {
if
([v isKindOfClass:[UIButton
class
]])
[((UIButton *)v) setExclusiveTouch:YES];
else
if
([v isKindOfClass:[UIView
class
]]){
[self setExclusiveTouchForButtons:v];
}
}
}
在Controller中的
- (void)viewDidAppear:(BOOL)animated
调用此方法,可以达到设置效果。
时间: 2024-10-12 13:27:57