添加键盘功能viewUI改动
This commit is contained in:
@@ -22,26 +22,38 @@
|
||||
self.contentView.layer.cornerRadius = 12;
|
||||
self.contentView.layer.masksToBounds = YES;
|
||||
|
||||
[self.contentView addSubview:self.iconViewInternal];
|
||||
[self.contentView addSubview:self.titleLabelInternal];
|
||||
// 小菊花:默认隐藏,放在整体内容右侧偏内的位置
|
||||
[self.contentView addSubview:self.loadingView];
|
||||
[self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.equalTo(self.contentView);
|
||||
make.width.height.mas_equalTo(16);
|
||||
}];
|
||||
|
||||
// 中心容器:将 icon + title 组合整体水平居中
|
||||
UIView *centerContainer = [[UIView alloc] init];
|
||||
centerContainer.backgroundColor = [UIColor clearColor];
|
||||
[self.contentView addSubview:centerContainer];
|
||||
[centerContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self.contentView.mas_centerX);
|
||||
make.centerY.equalTo(self.contentView.mas_centerY);
|
||||
make.left.greaterThanOrEqualTo(self.contentView.mas_left).offset(6);
|
||||
make.right.lessThanOrEqualTo(self.contentView).offset(-6);
|
||||
}];
|
||||
|
||||
[centerContainer addSubview:self.iconViewInternal];
|
||||
[centerContainer addSubview:self.titleLabelInternal];
|
||||
|
||||
[self.iconViewInternal mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.contentView.mas_left).offset(10);
|
||||
make.centerY.equalTo(self.contentView.mas_centerY);
|
||||
make.left.equalTo(centerContainer.mas_left);
|
||||
make.centerY.equalTo(centerContainer.mas_centerY);
|
||||
// 留出一点余量,避免 emoji 字形在右侧被裁剪
|
||||
make.width.height.mas_equalTo(24);
|
||||
}];
|
||||
[self.titleLabelInternal mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.iconViewInternal.mas_right).offset(6);
|
||||
make.right.equalTo(self.contentView.mas_right).offset(-10);
|
||||
make.centerY.equalTo(self.contentView.mas_centerY);
|
||||
}];
|
||||
|
||||
// 小菊花:默认隐藏,放在标题右侧
|
||||
[self.contentView addSubview:self.loadingView];
|
||||
[self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.contentView);
|
||||
make.right.equalTo(self.contentView.mas_right).offset(-10);
|
||||
make.width.height.mas_equalTo(16);
|
||||
make.left.equalTo(self.iconViewInternal.mas_right).offset(3);
|
||||
make.top.equalTo(centerContainer.mas_top);
|
||||
make.bottom.equalTo(centerContainer.mas_bottom);
|
||||
make.right.equalTo(centerContainer.mas_right);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
@@ -56,6 +68,8 @@
|
||||
emoji.text = @"🙂"; // 占位图标
|
||||
emoji.textAlignment = NSTextAlignmentCenter;
|
||||
emoji.font = [UIFont systemFontOfSize:20];
|
||||
emoji.adjustsFontSizeToFitWidth = YES;
|
||||
emoji.minimumScaleFactor = 0.8;
|
||||
[_iconViewInternal addSubview:emoji];
|
||||
[emoji mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(_iconViewInternal);
|
||||
@@ -67,8 +81,11 @@
|
||||
- (UILabel *)titleLabelInternal {
|
||||
if (!_titleLabelInternal) {
|
||||
_titleLabelInternal = [[UILabel alloc] init];
|
||||
_titleLabelInternal.font = [UIFont systemFontOfSize:15 weight:UIFontWeightSemibold];
|
||||
_titleLabelInternal.textColor = [UIColor blackColor];
|
||||
_titleLabelInternal.font = [KBFont medium:10];
|
||||
_titleLabelInternal.textColor = [UIColor colorWithHex:0x1B1F1A];
|
||||
// 最多两行,文本过长时末尾截断
|
||||
_titleLabelInternal.numberOfLines = 2;
|
||||
_titleLabelInternal.lineBreakMode = NSLineBreakByTruncatingTail;
|
||||
}
|
||||
return _titleLabelInternal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user