标签:
原因:因为label自适应宽度得出来的labelsize.width是小数,才会有黑边
去除方法: 将labelsize.width转换成整数,如下:
CGSize size = CGSizeMake(SCREEN_WIDTH,timeLabelHeight);
CGSize labelsize = [_message[@"time"] sizeWithFont:[UIFont fontWithName:@"STHeitiSC-Light" size:timeLabelFontSize]constrainedToSize:size lineBreakMode:UILineBreakModeWordWrap];
_timeLabel.frame = CGRectMake((SCREEN_WIDTH-labelsize.width-10)/2, 10, (int)labelsize.width+10, timeLabelHeight);
_timeLabel.text = _message[@"time"];
标签:
原文地址:http://www.cnblogs.com/z-j-w/p/5088075.html