【发布时间】:2023-04-08 04:28:01
【问题描述】:
我目前正在像这样创建我的单元格
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
cell.imageView.image = [UIImage imageNamed:image];
cell.imageView.tintColor = [UIColor whiteColor];
cell.textLabel.text = @"Push me";
cell.textLabel.textColor = [UIColor whiteColor];
cell.userInteractionEnabled = YES;
return cell;
一切正常,但我的一些长文本在最后被截断。我怎样才能避免呢?我不想设置 numberOfLines 属性。
有没有办法我可以通过约束来安排我的 imageView 和 textlabel,这样我的文本看起来很好。我尝试向单元格的 contentView 添加约束,但这让我的单元格很奇怪。
我是 iOS 开发和学习的新手。任何帮助将不胜感激。
【问题讨论】:
标签: ios objective-c uitableview autolayout