HeathWang / HWPanModal

HWPanModal presents controller from bottom and drag to dismiss, high customize. iOS13 default modalPresentationStyle. 任意形式的底部弹框动画;头条、知乎、抖音弹出评论效果;地图浮层,iOS13 present默认模态效果。
MIT License
1.16k stars 198 forks source link

UIDatePicker 使用问题??? #44

Closed difoi closed 4 years ago

difoi commented 4 years ago

使用UITableView 滑动没有问题。 但是使用UIDatePicker,弹出和显示都没有问题;向下滑动时间选择时,会自动下滑关闭窗口,请问怎么解决???

override func longFormHeight() -> PanModalHeight {
    return PanModalHeight(type: .contentIgnoringSafeArea, height: 380.0)
}

override func anchorModalToLongForm() -> Bool {
    return true
}

override func panScrollable() -> UIScrollView? { return nil }

HeathWang commented 4 years ago
- (BOOL)shouldRespondToPanModalGestureRecognizer:(UIPanGestureRecognizer *)panGestureRecognizer {
    CGPoint loc = [panGestureRecognizer locationInView:self.view];
    return !CGRectContainsPoint(self.datePicker.frame, loc);

}

重写该方法,判断panGestureRecognizer location是否在dataPicker中。

difoi commented 4 years ago

非常感谢,重写 shouldRespond 就可以了

northcity commented 2 years ago

非常棒,解决了我的问题。作者大大真厉害!