Iphone “怎么做?”;pointInside:“;工作

Iphone “怎么做?”;pointInside:“;工作,iphone,objective-c,ios,uiview,Iphone,Objective C,Ios,Uiview,我正在做一些命中测试,遇到了令人困惑的情况 我有两个按钮“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]; 为了证

我正在做一些命中测试,遇到了令人困惑的情况

我有两个按钮“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>>
打印_favorite按钮的说明:
_shareButton的打印说明:

这是怎么回事?我是否误解了输出应该是什么?

根据文档,Well@Nippysaurus

:

这意味着点
CGPoint dunno=CGPointMake(11,7)位于视图内部,因为视图的边界与同一视图的框架不同

A point that is in the receiver’s local coordinate system (bounds).