본문 바로가기
iOS/iOS

[Apple] userInteractionEnabled

by 헤콩 2023. 2. 24.
반응형

본 게시글은 Apple Developer - userInteractionEnabled 를 해석한 글입니다.

 

 

 

userInteractionEnabled

 

"A Boolean value that determines whether user events are ignored and removed from the event queue."

 

 

 

userInteractionEnabled는 User Event를 무시할지, 그리고 Event Queue에서 제거할지를 결정하는 Boolean 값입니다.

 

userInteractionEnabled를 NO라고 설정했을 때는 touch, press, keyboard, focus event 가 무시되고, Event Queue에서 제거됩니다. YES라고 설정했을 때는 해당 이벤트들이 정상적으로 뷰에 전달되고, userInteractionEnabled의 기본값은 YES입니다.

 

애니메이션이 동작하고 있을 때는 userInteractionEnabled 값에 상관없이 애니메이션과 관련된 모든 뷰에 대해서 유저 인터렉션이 일시적으로 비활성화됩니다. 우리는 애니메이션을 구성할 때 UIViewAnimationOptionAllowUserInteraction 옵션을 통해서 해당 동작을 비활성화할 수 있습니다.

 

반응형

댓글