0
누군가 초를 보내고 포인터를주세요.왜 hitTest가 창에 첨부 된보기를 반환하지 않습니까?
나는 UIWindow에 첨부 된 UIView가 있으며, 여기에 들어가기보다 훨씬 복잡한 이유 때문에 점의 hitTesting을 사용하고 있습니다.
을 감안할 때 윈도우의 하위보기로 연결된보기, 나는 그러나 hitTest보기를 찾을 것이라고 기대하지만,가 나타나지 않습니다- (void)test_hitTest_shouldFindTheViewAttachedToAWindow {
UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 210, 520)];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(10, 20, 200, 500)];
[window addSubview:view];
// This is ok
GHAssertEquals([view hitTest:CGPointMake(110, 270) withEvent:nil], view, nil);
// This fails: why? I would expect it to return the view, but it return null.
GHAssertEquals([view.window hitTest:CGPointMake(110, 270) withEvent:nil], view, nil);
}
점은의 경계 안에 삭제됩니다 창문 맞지? 왜 그 견해를 찾지 못합니까?
감사합니다. 명백한 해결책 :) –