微博列表类似微博列表,有头像,文字,配图.现在这么计算:
CGSize textSize = [string sizeWithFont:[UIFont systemFontOfSize:16.0f] constrainedToSize:CGSizeMake(260.0f, 2000.0f) lineBreakMode:NSLineBreakByWordWrapping];
float cellHeight = textSize.height + 50.0f
self.weiboImageView = [[UIImageView alloc] initWithFrame: CGRectMake(65.0, self.cellHeight, 100, 124)];
self.weiboImageView.contentMode = UIViewContentModeScaleAspectFit;
但是这么计算不准确,有时文字显示不全.有时图小得时候空白太多.有时图大的时候会压到底部Cell的线.
我猜可能有两个原因: 1,你是用uitextview来显示文字,uitextview的显示区域和自身宽度不同。 2,uitextview的折行模式和你计算时所使用的模式不同。