读书人

iOS 禁用多旋钮同时点击效果

发布时间: 2012-10-12 10:17:04 作者: rapoo

iOS 禁用多按钮同时点击效果

公司里的测试们总是喜欢在一些并不是关键点上纠结Bug,最常见Screen里有多个可以点击的按钮或者视图,如果同时点击它们的话可能会出现各种错误异常之类的,而测试特别津津乐道于此类问题,看到有的项目为了修复此类问题竟然使用一个BOOL来标记判断然后维护起来极其恐怖,其实有非常简单的方法实现[view setExclusiveTouch:YES];官方文档解释exclusiveTouchA Boolean value that indicates whether the receiver handles touch events exclusively.@property(nonatomic, getter=isExclusiveTouch) BOOL exclusiveTouchDiscussionSetting this property to YES causes the receiver to block the delivery of touch events to other views in the same window. The default value of this property is NO.AvailabilityAvailable in iOS 2.0 and later.See Also  @property multipleTouchEnabledDeclared InUIView.h

读书人网 >操作系统

热点推荐