標籤:style class color get strong 類
userInteractionEnabled
A Boolean value that determines whether user events are ignored and removed from the event queue.
譯:一個布爾值,它決定了是否使用者觸發的事件被該視圖對象忽略和把該視圖對象從事件響應隊列中移除。
@property(nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled
userInteractionEnabled的getter方法是isUserInteractionEnabled;
我們可以通過isUserInteractionEnabled方法,得到userInteractionEnabled的布爾值。
Discussion
When set to NO, user events—such as touch and keyboard—intended for the view are ignored and removed from the event queue. When set to YES, events are delivered to the view normally. The default value of this property is YES.
譯:當視圖對象的userInteractionEnabled設定為NO的時候,使用者觸發的事件,如觸摸,鍵盤等,將會被該視圖忽略(其他視圖照常響應),並且該視圖對象也會從事件響應隊列中被移除。 當userInteractionEnabled設為YES時,則事件可以正常的傳遞給該視圖對象。 userInteractionEnabled的屬性預設值就是YES。
ps:響應者鏈是能夠響應事件的對象組成的鏈,事件在該鏈上傳遞,最終結果事件或被處理或被拋棄。所以一個對象在不在響應者鏈裡是其能否響應事件的首要前提條件!
During an animation, user interactions are temporarily disabled for all views involved in the animation, regardless of the value in this property. You can disable this behavior by specifying the UIViewAnimationOptionAllowUserInteraction option when configuring the animation.
譯:在播放動畫的時候,不論userInteractionEnabled的值是YES還是NO,使用者互動會被臨時設定為不支援互動的狀態。
如果在播放動畫的時候,你想讓對象依然保持可互動狀態,那麼你需要設定動畫的UIViewAnimationOptions的屬性值為UIViewAnimationOptionAllowUserInteraction。
Note: Some UIKit subclasses override this property and return a different default value. See the documentation for that class to determine if it returns a different value.
注意:一些UIKit的子類重寫了這個屬性,而導致返回不同的預設值。具體的你 需要看所選擇的類的文檔,看是否userInteractionEnabled被設定了不同的預設傳回值。
Declared In UIView.h