2011-08-23 11 views
3

나는 약간의 히트 테스트를하고 있으며 혼란스러운 상황에 처해있다."pointInside :"는 어떻게 작동합니까?

두 개의 버튼 "favoriteButton"과 "shareButton"이 있습니다. 'A'와 진실되고 'B'에서 다음 코드의 결과는 버튼이 중복되지 않더라도 :

CGPoint dunno = CGPointMake(11, 7); 

BOOL a = [self.favoriteButton pointInside:dunno withEvent:nil]; 
BOOL b = [self.shareButton pointInside:dunno withEvent:nil]; 

단지 그것을 증명하기 위해, 여기에이 코드를 그 지점에서 두 개의 버튼에 대한 설명 출력은 호출되고 있습니다.

Printing description of _favoriteButton: 
<UIButton: 0x5da8c90; frame = (10 6; 37 35); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x5da8d40>> 
Printing description of _shareButton: 
<UIButton: 0x5da7150; frame = (46 6; 30 35); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x5da59b0>> 

어떻게 될까요? 결과물을 오해해야할까요? 문서

http://developer.apple.com/library/iOS/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/pointInside:withEvent 따른

답변

1

음 @Nippysaurus :

뷰의 경계가 다른 것 같이 CGPoint dunno = CGPointMake(11, 7); 뷰 안에 그 지점을 의미
A point that is in the receiver’s local coordinate system (bounds). 

동일한 뷰 프레임있다.

관련 문제