1
This commit is contained in:
@@ -445,13 +445,19 @@
|
||||
_dragArrowImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
// 初始在 Short 状态,显示向上的箭头
|
||||
_dragArrowImageView.image = [UIImage imageNamed:@"home_up_arrow"];
|
||||
// 可点击:点击根据箭头方向在“最高/最低”之间切换
|
||||
_dragArrowImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(kb_onTapDragArrow)];
|
||||
[_dragArrowImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _dragArrowImageView;
|
||||
}
|
||||
|
||||
// 根据弹窗展示状态切换箭头图
|
||||
- (void)kb_updateDragArrowForState:(PresentationState)state {
|
||||
NSString *imgName = (state == PresentationStateMedium) ? @"home_down_arrow" : @"home_up_arrow";
|
||||
// 视为“最高态”的状态:Medium 或 Long(当两者高度一致时,库可能标记为 Long)
|
||||
BOOL isAtTop = (state == PresentationStateMedium || state == PresentationStateLong);
|
||||
NSString *imgName = isAtTop ? @"home_down_arrow" : @"home_up_arrow";
|
||||
UIImage *img = [UIImage imageNamed:imgName];
|
||||
if (img && self.dragArrowImageView.image != img) {
|
||||
// 柔和切换,避免频繁拖拽时突兀
|
||||
@@ -464,6 +470,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// 点击顶部拖拽方向箭头:
|
||||
/// - 当箭头朝上(当前非最高态),点击切换到最高态(Medium)。
|
||||
/// - 当箭头朝下(当前最高态),点击切换到最低态(Short)。
|
||||
- (void)kb_onTapDragArrow {
|
||||
// 以当前展示状态为准做切换
|
||||
PresentationState state = self.hw_presentationState;
|
||||
BOOL isAtTop = (state == PresentationStateMedium || state == PresentationStateLong);
|
||||
if (isAtTop) {
|
||||
// 已在最高态 -> 切到最低态
|
||||
[self hw_panModalTransitionTo:PresentationStateShort];
|
||||
} else {
|
||||
// 不在最高态 -> 切到最高态
|
||||
[self hw_panModalTransitionTo:PresentationStateMedium];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (UIImageView *)leftBgImageView{
|
||||
if (!_leftBgImageView) {
|
||||
|
||||
Reference in New Issue
Block a user