1
This commit is contained in:
@@ -106,7 +106,7 @@
|
||||
[topBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self);
|
||||
make.top.equalTo(self.mas_top).offset(4);
|
||||
make.height.mas_equalTo(44);
|
||||
make.height.mas_equalTo(40);
|
||||
}];
|
||||
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(topBar.mas_left).offset(12);
|
||||
@@ -151,14 +151,14 @@
|
||||
self.tabStackView = [[UIStackView alloc] init];
|
||||
self.tabStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
self.tabStackView.spacing = 8;
|
||||
self.tabStackView.alignment = UIStackViewAlignmentCenter;
|
||||
self.tabStackView.alignment = UIStackViewAlignmentFill;
|
||||
[self.tabScrollView addSubview:self.tabStackView];
|
||||
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.mas_left).offset(12);
|
||||
make.right.equalTo(self.mas_right).offset(-12);
|
||||
make.top.equalTo(topBar.mas_bottom).offset(8);
|
||||
make.bottom.equalTo(self.bottomBar.mas_top).offset(-8);
|
||||
make.top.equalTo(topBar.mas_bottom).offset(0);
|
||||
make.bottom.equalTo(self.bottomBar.mas_top).offset(0);
|
||||
}];
|
||||
|
||||
[self.bottomBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -177,8 +177,8 @@
|
||||
make.left.equalTo(self.bottomBar.mas_left).offset(12);
|
||||
// make.right.equalTo(self.searchButton.mas_left).offset(-12);
|
||||
make.right.equalTo(self.bottomBar.mas_right).offset(-12);
|
||||
make.top.equalTo(self.bottomBar.mas_top).offset(8);
|
||||
make.bottom.equalTo(self.bottomBar.mas_bottom).offset(-8);
|
||||
make.top.equalTo(self.bottomBar.mas_top).offset(4);
|
||||
make.bottom.equalTo(self.bottomBar.mas_bottom).offset(-4);
|
||||
}];
|
||||
|
||||
[self.tabStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -196,6 +196,23 @@
|
||||
[self applyTheme:[KBSkinManager shared].current];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
[self updateTabButtonCornerRadii];
|
||||
}
|
||||
|
||||
- (void)updateTabButtonCornerRadii {
|
||||
if (self.tabButtons.count == 0) { return; }
|
||||
for (UIButton *btn in self.tabButtons) {
|
||||
CGFloat radius = MIN(CGRectGetHeight(btn.bounds), CGRectGetWidth(btn.bounds)) / 2.0;
|
||||
if (radius <= 0) { continue; }
|
||||
btn.layer.cornerRadius = radius;
|
||||
if (@available(iOS 13.0, *)) {
|
||||
btn.layer.cornerCurve = kCACornerCurveContinuous;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)registerNotifications {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(onEmojiDataChanged)
|
||||
@@ -241,10 +258,13 @@
|
||||
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[btn addTarget:self action:@selector(onTabTapped:) forControlEvents:UIControlEventTouchUpInside];
|
||||
btn.contentEdgeInsets = UIEdgeInsetsMake(0, 12, 0, 12);
|
||||
btn.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
// [btn.heightAnchor constraintEqualTo:self.tabScrollView.heightAnchor].active = YES;
|
||||
[self.tabStackView addArrangedSubview:btn];
|
||||
[buttons addObject:btn];
|
||||
}];
|
||||
self.tabButtons = buttons.copy;
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (void)updateSelectionToIndex:(NSInteger)index {
|
||||
|
||||
Reference in New Issue
Block a user