보조보기는 UICollectionViewCell
이 아닌 UICollectionReusableView
(또는 그 하위 클래스)이어야합니다.
어쨌든 버튼이 응답하지 않으면 먼저 모든 조상 뷰에 userInteractionEnabled
이 YES
으로 설정되어 있는지 확인해야합니다. 버튼이 화면에 나타나면 디버거에서 일시 중지하고 다음을 수행하십시오.
(lldb) po [[UIApp keyWindow] recursiveDescription]
목록에서 단추를 찾아서 복사하십시오. 그런 다음 각 수퍼 뷰를 확인할 수 있습니다. 예 :
(lldb) p (BOOL)[0xa2e4800 isUserInteractionEnabled]
(BOOL) $4 = YES
(lldb) p (BOOL)[[0xa2e4800 superview] isUserInteractionEnabled]
(BOOL) $5 = YES
(lldb) p (BOOL)[[[0xa2e4800 superview] superview] isUserInteractionEnabled]
(BOOL) $6 = YES
(lldb) p (BOOL)[[[[0xa2e4800 superview] superview] superview] isUserInteractionEnabled]
(BOOL) $8 = YES
(lldb) p (BOOL)[[[[[0xa2e4800 superview] superview] superview] superview] isUserInteractionEnabled]
(BOOL) $9 = YES
(lldb) p (BOOL)[[[[[[0xa2e4800 superview] superview] superview] superview] superview] isUserInteractionEnabled]
(BOOL) $10 = NO
(lldb) po [[[[[0xa2e4800 superview] superview] superview] superview] superview]
(id) $11 = 0x00000000 <nil>
는 여기에 루트합니다 (
UIWindow
)까지 모든 뷰가
isUserInteractionEnabled
에서
YES
을 반환 것을 발견했다. 창 슈퍼 뷰는 nil입니다.
@robmayhoff : 문제는 내가 잘못된 부모를 서브 클래 싱했다는 사실이었습니다. 이걸 가져 주셔서 감사합니다! – markdorison
@markdorison 하하하 흥미 롭습니다. 그게 정말로 문제라고 생각하지 않았습니다. –
@robmayhoff : 나는 하나의 변화를 만들어 냈을 때처럼 놀랐습니다! – markdorison