修改UI
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
|
||||
#import "KBTagCell.h"
|
||||
|
||||
static const CGFloat kKBTagMinWidth = 50.0;
|
||||
|
||||
@interface KBTagCell ()
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
@end
|
||||
@@ -29,10 +31,11 @@
|
||||
}
|
||||
|
||||
+ (CGSize)sizeForText:(NSString *)text {
|
||||
if (text.length == 0) { return CGSizeMake(40, 32); }
|
||||
if (text.length == 0) { return CGSizeMake(kKBTagMinWidth, 32); }
|
||||
CGSize s = [text sizeWithAttributes:@{NSFontAttributeName:[KBFont regular:13]}];
|
||||
// 两侧内边距 12 + 12,高度固定 32
|
||||
return CGSizeMake(ceil(s.width) + 24, 32);
|
||||
CGFloat width = ceil(s.width) + 24;
|
||||
return CGSizeMake(MAX(width, kKBTagMinWidth), 32);
|
||||
}
|
||||
|
||||
#pragma mark - Lazy
|
||||
@@ -42,9 +45,9 @@
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [KBFont regular:13];
|
||||
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user