[Error] UITapGestureRecognizer issue

 

... ... layer = <CALayer: 0x6000034a5c00>>) at a time, this was never allowed, and is now enforced. Beginning with iOS 9.0 it will be put in the first view it is loaded into.

 

전문은 아마 이 분과 비슷했을 것이다. ^_^

 

 

 

 

더보기
etc-image-0
https://developer.apple.com/forums/thread/97110

 

 

사유는 간단하다. 한 제스쳐를 여러 뷰에 추가할 수 없기 때문!

 

기본으로 제스쳐를 추가한 뒤에도 혹시나... 하고 ctrl 을 눌러서 뷰를 추가해 줬는데 그게 당근... 문제가 생겼나 보다.

 

해결 방법은 간단하다!

 

etc-image-1

 

해당 인스펙터 영역에서 gesutreRecognizers에 연결되어 있는 뷰를 해제해 주면 된다.

 

 

이외에도 ImageView / Label에 gesture를 추가하면 인식되지 않는 이유를 알게 되어 덧붙여 적어 보자면,

 

isUserInteractionEnabled가 디폴트 설정으로 false가 되어 있기 때문이다!

 

어? 그럼 UIView는 왜 되는데?!

 

바로 isUserInteractionEnabled가 true로 되어 있기 때문 ... ... ^_^

 

UIView도 isUserInteractionEnabled의 값을 false로 바꿔주면 gesture가 동작하지 않는다.

 

신기~

 

 

 

 

 

 

https://developer.apple.com/forums/thread/97110

 

Localization and tap gesture | Apple Developer Forums

I want to let user chage the language directly from the app (imagine I want to show to a foreign friend, I don't want to be force to change the phone setting). Anyway, I found the problem, not related to this : when I create a tapGestureRecognizer in IB, I

developer.apple.com

https://stackoverflow.com/questions/32632322/uitapgesturerecognizer-issue-in-ios-9

 

UITapGestureRecognizer issue in iOS 9

I guys, today I've updated my iPhone to iOS 9 and now have problems with a gesture recognizer. This is the error: WARNING: A Gesture recognizer (; target= <(action=onVideoTap:, target=)>>)...

stackoverflow.com

 

'iOS' 카테고리의 다른 글

[Swift] instance / Type  (0) 2023.08.01
[Swift] Enum  (0) 2023.07.30
[UIKit] UITableViewController  (0) 2023.07.27
[Swift] Date.formatted()  (2) 2023.07.27
[UIKit] Button의 title은 setTitle로 설정하자  (2) 2023.07.26