1
This commit is contained in:
@@ -14,6 +14,13 @@
|
||||
@property (nonatomic, strong) KBDirectionIndicatorView *indicator;
|
||||
// 顶部切换按钮与指示条
|
||||
@property (nonatomic, strong) UIView *topBar;
|
||||
@property (nonatomic, strong) UIView *contentView;
|
||||
@property (nonatomic, strong) UIImageView *leftImageView;
|
||||
@property (nonatomic, strong) UIImageView *rightImageView;
|
||||
/// 皇冠👑
|
||||
@property (nonatomic, strong) UIImageView *hgImageView;
|
||||
|
||||
|
||||
@property (nonatomic, strong) UIButton *hotButton;
|
||||
@property (nonatomic, strong) UIButton *rankButton;
|
||||
@property (nonatomic, strong) UIView *underlineView; // 选中下划线
|
||||
@@ -34,6 +41,30 @@
|
||||
// HWBackgroundConfig *config = [HWBackgroundConfig configWithBehavior:HWBackgroundBehaviorDefault];
|
||||
// config.backgroundAlpha = 0;
|
||||
// [self.hw_dimmedView reloadConfig:config];
|
||||
|
||||
// 添加容器
|
||||
[self addSubview:self.contentView];
|
||||
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self).inset(16);
|
||||
make.top.equalTo(self).offset(48);
|
||||
make.bottom.equalTo(self);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.leftImageView];
|
||||
[self.contentView addSubview:self.rightImageView];
|
||||
[self.leftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self.contentView);
|
||||
make.top.equalTo(self.contentView);
|
||||
make.height.mas_equalTo(79);
|
||||
}];
|
||||
[self.rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self.contentView);
|
||||
make.top.equalTo(self.contentView);
|
||||
make.height.equalTo(self.leftImageView);
|
||||
|
||||
}];
|
||||
|
||||
|
||||
// 顶部按钮 + 容器
|
||||
[self setupTopButtonsAndContainer];
|
||||
// 默认展示“热门”
|
||||
@@ -43,9 +74,9 @@
|
||||
}
|
||||
|
||||
- (HWBackgroundConfig *)backgroundConfig {
|
||||
// return [HWBackgroundConfig configWithBehavior:HWBackgroundBehaviorSystemVisualEffect];
|
||||
HWBackgroundConfig *config = [HWBackgroundConfig configWithBehavior:HWBackgroundBehaviorDefault];
|
||||
config.backgroundAlpha = 0;
|
||||
config.blurTintColor = [UIColor clearColor];
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -142,7 +173,7 @@
|
||||
- (void)setupTopButtonsAndContainer {
|
||||
// 顶部栏
|
||||
self.topBar = [[UIView alloc] init];
|
||||
self.topBar.backgroundColor = [UIColor colorWithWhite:1 alpha:0.9];
|
||||
// self.topBar.backgroundColor = [UIColor colorWithWhite:1 alpha:0.9];
|
||||
[self addSubview:self.topBar];
|
||||
// 首次展示时先隐藏,待转场完成后再淡入,避免“自底向上滑入”的错觉
|
||||
// self.topBar.alpha = 0.0;
|
||||
@@ -174,12 +205,12 @@
|
||||
|
||||
// 容器视图
|
||||
self.containerView = [[UIView alloc] init];
|
||||
self.containerView.backgroundColor = [UIColor whiteColor];
|
||||
self.containerView.backgroundColor = [UIColor redColor];
|
||||
self.containerView.clipsToBounds = YES;
|
||||
[self addSubview:self.containerView];
|
||||
|
||||
// Masonry 约束
|
||||
CGFloat topPadding = 12; // 与顶部小指示器留点空间
|
||||
CGFloat topPadding = 47; // 与顶部小指示器留点空间
|
||||
[self.topBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self);
|
||||
make.top.equalTo(self).offset(topPadding);
|
||||
@@ -280,4 +311,40 @@
|
||||
[self.topBar layoutIfNeeded];
|
||||
}
|
||||
}
|
||||
|
||||
- (UIView *)contentView{
|
||||
if (!_contentView) {
|
||||
_contentView = [[UIView alloc] init];
|
||||
}
|
||||
return _contentView;
|
||||
}
|
||||
|
||||
- (UIImageView *)leftImageView{
|
||||
if (!_leftImageView) {
|
||||
_leftImageView = [[UIImageView alloc] init];
|
||||
_leftImageView.image = [UIImage imageNamed:@"home_left_image"];
|
||||
_leftImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
}
|
||||
return _leftImageView;
|
||||
}
|
||||
|
||||
- (UIImageView *)rightImageView{
|
||||
if (!_rightImageView) {
|
||||
_rightImageView = [[UIImageView alloc] init];
|
||||
_rightImageView.image = [UIImage imageNamed:@"home_right_image"];
|
||||
_rightImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
_rightImageView.hidden = true;
|
||||
}
|
||||
return _rightImageView;
|
||||
}
|
||||
|
||||
- (UIImageView *)hgImageView{
|
||||
if (!_hgImageView) {
|
||||
_hgImageView = [[UIImageView alloc] init];
|
||||
_hgImageView.image = [UIImage imageNamed:@"home_hg_icon"];
|
||||
_hgImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
}
|
||||
return _hgImageView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user