最近钉钉更新了新的版本,觉得TabBar很有意思,就写了一个,先上一个效果图吧
核心的关键点就在事件响应上,需要判断触摸点区域,然后转发到对应的view上传递
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
if ([self.touchDelegate respondsToSelector:@selector(shouldTouchPulleyScrollView:point:)]) {
if ([self.touchDelegate shouldTouchPulleyScrollView:self point:point]) {
UIView *view = [self.touchDelegate viewToReceiveTouch:self point:point];
CGPoint p = [view convertPoint:point fromView:self];
return [view hitTest:p withEvent:event];
}
}
return [super hitTest:point withEvent:event];
}