74 lines
1.7 KiB
Objective-C
74 lines
1.7 KiB
Objective-C
//
|
|
// HomeSheetVC.m
|
|
// keyBoard
|
|
//
|
|
// Created by Mac on 2025/11/5.
|
|
//
|
|
|
|
#import "HomeSheetVC.h"
|
|
#import "KBDirectionIndicatorView.h"
|
|
|
|
@interface HomeSheetVC ()
|
|
@property (nonatomic, strong) KBDirectionIndicatorView *indicator;
|
|
@end
|
|
|
|
@implementation HomeSheetVC
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
// Do any additional setup after loading the view.
|
|
self.view.backgroundColor = [UIColor redColor];
|
|
}
|
|
|
|
- (UIView<HWPanModalIndicatorProtocol> *)customIndicatorView {
|
|
if (!_indicator) _indicator = [KBDirectionIndicatorView new];
|
|
return _indicator;
|
|
}
|
|
|
|
- (void)panModalTransitionDidFinish {
|
|
// 初次展示后按当前状态设定一次朝向
|
|
[self.indicator applyPresentationState:self.hw_presentationState];
|
|
}
|
|
|
|
- (void)didChangeTransitionToState:(PresentationState)state {
|
|
// 每次状态切换完成后刷新朝向
|
|
[self.indicator applyPresentationState:state];
|
|
}
|
|
|
|
- (PanModalHeight)shortFormHeight {
|
|
return PanModalHeightMake(PanModalHeightTypeContent, self.minHeight ?: 300);
|
|
}
|
|
|
|
- (PanModalHeight)longFormHeight {
|
|
return PanModalHeightMake(PanModalHeightTypeMaxTopInset, self.topInset ?: 100);
|
|
}
|
|
|
|
- (PresentationState)originPresentationState {
|
|
return PresentationStateShort; // 初始就以最小高度展示
|
|
}
|
|
|
|
- (BOOL)anchorModalToLongForm {
|
|
return YES; // 到 long 后不再继续往上拖
|
|
}
|
|
|
|
- (BOOL)allowsPullDownWhenShortState {
|
|
return NO; // 在 short 状态禁止继续往下拉(锁住最小高度)
|
|
}
|
|
|
|
// 可选:完全不允许拖拽关闭(避免被拉到底消失)
|
|
- (BOOL)allowsDragToDismiss {
|
|
return NO;
|
|
}
|
|
|
|
//- (BOOL)showDragIndicator{
|
|
// return NO;
|
|
//}
|
|
|
|
// 点背景不关闭
|
|
- (BOOL)allowsTapBackgroundToDismiss {
|
|
return NO;
|
|
}
|
|
|
|
|
|
@end
|