|
|
@ -15,6 +15,9 @@ |
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic ,weak) UILabel *titleLabel; |
|
|
|
@property (nonatomic ,weak) UILabel *titleLabel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic ,weak) UILabel *msgNumLabel; |
|
|
|
|
|
|
|
|
|
|
|
@end |
|
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
@implementation MyTableViewCell |
|
|
|
@implementation MyTableViewCell |
|
|
@ -47,6 +50,18 @@ |
|
|
|
- (void)setMessageCount:(NSNumber *)messageCount |
|
|
|
- (void)setMessageCount:(NSNumber *)messageCount |
|
|
|
{ |
|
|
|
{ |
|
|
|
_messageCount = messageCount; |
|
|
|
_messageCount = messageCount; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.msgNumLabel.hidden = messageCount.integerValue > 0 && [self.titleName isEqualToString:@"消息中心"] ? NO : YES; |
|
|
|
|
|
|
|
self.msgNumLabel.text = [NSString stringWithFormat:@"%@",messageCount]; |
|
|
|
|
|
|
|
if (messageCount.integerValue > 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CGFloat ww = messageCount.integerValue > 9 && messageCount.integerValue < 100 ? 25 : messageCount.integerValue > 99 ? 32 : 20; |
|
|
|
|
|
|
|
[self.msgNumLabel mas_remakeConstraints:^(MASConstraintMaker *make) { |
|
|
|
|
|
|
|
make.right.equalTo(self.contentView.mas_right).inset(15); |
|
|
|
|
|
|
|
make.centerY.equalTo(self.contentView); |
|
|
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(ww, 20)); |
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (void)subCellView |
|
|
|
- (void)subCellView |
|
|
@ -68,6 +83,20 @@ |
|
|
|
make.centerY.equalTo(self.contentView); |
|
|
|
make.centerY.equalTo(self.contentView); |
|
|
|
}]; |
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UILabel *msgNumLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(13) textColor:KKWhiteColorColor text:@"" Radius:10]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msgNumLabel.layer.borderWidth = 1.5; |
|
|
|
|
|
|
|
msgNumLabel.layer.borderColor = KKWhiteColorColor.CGColor; |
|
|
|
|
|
|
|
msgNumLabel.backgroundColor = RGB(254, 83, 71); |
|
|
|
|
|
|
|
msgNumLabel.hidden = YES; |
|
|
|
|
|
|
|
self.msgNumLabel = msgNumLabel; |
|
|
|
|
|
|
|
[self.contentView addSubview:msgNumLabel]; |
|
|
|
|
|
|
|
[msgNumLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
|
|
|
|
make.right.equalTo(self.contentView.mas_right).inset(15); |
|
|
|
|
|
|
|
make.centerY.equalTo(self.contentView); |
|
|
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(20, 20)); |
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|