#warning 需要时刻根据现在的时间字符串来计算时间label的frame
// 3.时间
NSString *time = status.created_at;
self.timeLabel.text = time; // 刚刚 --> 1分钟前 --> 10分钟前
CGFloat timeX = CGRectGetMinX(self.nameLabel.frame);
CGFloat timeY = CGRectGetMaxY(self.nameLabel.frame) + HMStatusCellInset * 0.5;
CGSize timeSize = [time sizeWithFont:HMStatusOrginalTimeFont];
self.timeLabel.frame = (CGRect){{timeX, timeY}, timeSize};
// 4.来源
self.sourceLabel.text = status.source;
CGFloat sourceX = CGRectGetMaxX(self.timeLabel.frame) + HMStatusCellInset;
CGFloat sourceY = timeY;
CGSize sourceSize = [status.source sizeWithFont:HMStatusOrginalSourceFont];
self.sourceLabel.frame = (CGRect){{sourceX, sourceY}, sourceSize};
- (void)setSource:(NSString *)source
{
// 截取范围
NSRange range;
range.location = [source rangeOfString:@">"].location + 1;
range.length = [source rangeOfString:@"</"].location - range.location;
// 开始截取
NSString *subsource = [source substringWithRange:range];
_source = [NSString stringWithFormat:@"来自%@", subsource];
}
点击按钮进入别的导航器,
需要设置。self.userInteractionEnabled = YES;
- (id)initWithFrame:(CGRect)frame()方法中若没有设置frame,控件不会显示。
联系客服