修改UI
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
@property (nonatomic, strong) UIViewController *currentChild;
|
||||
@property (nonatomic, strong) HomeHotVC *hotVC;
|
||||
@property (nonatomic, strong) HomeRankVC *rankVC;
|
||||
@property (nonatomic, assign) NSInteger currentIndex;
|
||||
|
||||
@end
|
||||
@implementation KBPanModalView
|
||||
|
||||
@@ -83,6 +85,10 @@
|
||||
return NO; // 在 short 状态禁止继续往下拉(锁住最小高度)
|
||||
}
|
||||
|
||||
- (CGFloat)topOffset{
|
||||
return 0.001;
|
||||
}
|
||||
|
||||
/// 允许时间穿透
|
||||
- (BOOL)allowsTouchEventsPassingThroughTransitionView {
|
||||
return YES;
|
||||
@@ -94,7 +100,10 @@
|
||||
|
||||
|
||||
- (UIScrollView *)panScrollable {
|
||||
return self.hotVC.tableView;
|
||||
if (self.currentIndex == 0) {
|
||||
return self.hotVC.tableView;
|
||||
}
|
||||
return self.rankVC.tableView;
|
||||
}
|
||||
|
||||
// 可选:完全不允许拖拽关闭(避免被拉到底消失)
|
||||
@@ -130,7 +139,7 @@
|
||||
self.topBar.backgroundColor = [UIColor colorWithWhite:1 alpha:0.9];
|
||||
[self addSubview:self.topBar];
|
||||
// 首次展示时先隐藏,待转场完成后再淡入,避免“自底向上滑入”的错觉
|
||||
self.topBar.alpha = 0.0;
|
||||
// self.topBar.alpha = 0.0;
|
||||
|
||||
// 两个按钮
|
||||
self.hotButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
@@ -200,12 +209,13 @@
|
||||
|
||||
- (void)onTapTopButton:(UIButton *)sender {
|
||||
[self switchToIndex:sender.tag animated:YES];
|
||||
[self hw_panModalSetNeedsLayoutUpdate];
|
||||
// [self hw_panModalSetNeedsLayoutUpdate];
|
||||
}
|
||||
|
||||
#pragma mark - Switch Child
|
||||
|
||||
- (void)switchToIndex:(NSInteger)index animated:(BOOL)animated {
|
||||
self.currentIndex = index;
|
||||
UIViewController *target = (index == 0) ? self.hotVC : self.rankVC;
|
||||
if (!target) {
|
||||
if (index == 0) {
|
||||
@@ -235,11 +245,11 @@
|
||||
[self.containerView addSubview:target.view];
|
||||
target.view.backgroundColor = [UIColor colorWithWhite:0.98 alpha:1];
|
||||
[target.view mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.containerView);
|
||||
make.left.top.right.equalTo(self.containerView);
|
||||
make.bottom.equalTo(self.containerView).offset(-KB_TABBAR_HEIGHT);
|
||||
}];
|
||||
[target didMoveToParentViewController:self];
|
||||
// [target didMoveToParentViewController:self];
|
||||
self.currentChild = target;
|
||||
|
||||
[self updateButtonStateForIndex:index animated:animated];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user