[cpp]
公司裡的測試們總是喜歡在一些並不是關鍵點上糾結Bug,
最常見Screen裡有多個可以點擊的按鈕或者視圖,如果同時點擊它們的話可能會出現各種錯誤異常之類的,
而測試特別津津樂道於此類問題,看到有的項目為了修復此類問題竟然使用一個BOOL來標記判斷
然後維護起來極其恐怖,其實有非常簡單的方法實現
[view setExclusiveTouch:YES];
官方文檔解釋
exclusiveTouch
A Boolean value that indicates whether the receiver handles touch events exclusively.
@property(nonatomic, getter=isExclusiveTouch) BOOL exclusiveTouch
Discussion
Setting 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.
Availability
Available in iOS 2.0 and later.
See Also
@property multipleTouchEnabled
Declared In
UIView.h