- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
    UIView *view = [super hitTest:point withEvent:event];
    if (view == nil) {
        for (UIView *subView in self.subviews) {
            CGPoint tp = [subView convertPoint:point fromView:self];
            if (CGRectContainsPoint(subView.bounds, tp)) {
                view = subView;
            }
        }
    }
    
    return view;
}

 不让超出的子视图显示:

@property(nonatomic)                 BOOL              clipsToBounds;  

 

posted on 2015-08-26 09:41  墓厄  阅读(832)  评论(0编辑  收藏  举报