64 lines
2.2 KiB
Objective-C
64 lines
2.2 KiB
Objective-C
#import "KBEmojiBottomBarView.h"
|
|
#import "Masonry.h"
|
|
|
|
@interface KBEmojiBottomBarView ()
|
|
|
|
@property (nonatomic, strong, readwrite) UIScrollView *tabScrollView;
|
|
@property (nonatomic, strong, readwrite) UIStackView *tabStackView;
|
|
@property (nonatomic, strong, readwrite) UIButton *deleteButton;
|
|
|
|
@end
|
|
|
|
@implementation KBEmojiBottomBarView
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
if (self = [super initWithFrame:frame]) {
|
|
[self setupUI];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)setupUI {
|
|
self.backgroundColor = [UIColor clearColor];
|
|
|
|
self.tabScrollView = [[UIScrollView alloc] init];
|
|
self.tabScrollView.showsHorizontalScrollIndicator = NO;
|
|
self.tabScrollView.backgroundColor = [UIColor clearColor];
|
|
[self addSubview:self.tabScrollView];
|
|
|
|
self.tabStackView = [[UIStackView alloc] init];
|
|
self.tabStackView.axis = UILayoutConstraintAxisHorizontal;
|
|
self.tabStackView.spacing = 8;
|
|
self.tabStackView.alignment = UIStackViewAlignmentFill;
|
|
[self.tabScrollView addSubview:self.tabStackView];
|
|
|
|
self.deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
self.deleteButton.layer.cornerRadius = 16;
|
|
self.deleteButton.layer.masksToBounds = YES;
|
|
// self.deleteButton.titleLabel.font = [UIFont systemFontOfSize:24 weight:UIFontWeightSemibold];
|
|
// [self.deleteButton setTitle:@"⌫" forState:UIControlStateNormal];
|
|
[self.deleteButton setImage:[UIImage imageNamed:@"kb_del_icon"] forState:UIControlStateNormal];
|
|
[self addSubview:self.deleteButton];
|
|
|
|
[self.tabScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self.mas_left).offset(12);
|
|
make.right.equalTo(self.deleteButton.mas_left).offset(-12);
|
|
make.top.equalTo(self.mas_top).offset(4);
|
|
make.bottom.equalTo(self.mas_bottom).offset(-4);
|
|
}];
|
|
|
|
[self.tabStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.equalTo(self.tabScrollView);
|
|
make.height.equalTo(self.tabScrollView);
|
|
}];
|
|
|
|
[self.deleteButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.equalTo(self.mas_right).offset(-12);
|
|
make.centerY.equalTo(self);
|
|
make.width.mas_equalTo(44);
|
|
make.height.equalTo(self.tabScrollView);
|
|
}];
|
|
}
|
|
|
|
@end
|