ios - 标签大小以适应 UITableView

标签 ios objective-c uitableview uilabel sizetofit

UILabelsizeToFit 方法不适用于cellForRowAtIndexPath

问题是我需要我的一些细胞看起来像这样: enter image description here

和其他人看起来像这样: enter image description here

解决这个问题的方法是什么?

谢谢

最佳答案

在 Storyboard中禁用自动布局后,sizeToFit 方法执行它在 cellForRowAtIndexPath 方法中应该执行的操作。

关于ios - 标签大小以适应 UITableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23652439/

相关文章:

ios - 为什么当我在 swift 3 中从图库中获取照片时, Collection View 为空?

ios - 在导航 Controller 中添加一次公共(public) View

ios - 如何在 Swift 中打开保存到相册的图像?

ios - 用于 iOS 中数据矩阵扫描的 SDK

ios - 在UITableView中使用自动布局以获取动态单元格布局和可变的行高

iphone - TableView无法正确显示并崩溃,

带有 fetchedresultscontroller 的 ios UITableView - 添加自定义行

objective-c - 如何将Objective-C语言(“va_list”,“va_start”,“va_end”)转换为快速语言?

objective-c - "Prepare Content"NSArrayController 设置已关闭 : how to fetch the content?

ios - 在 iOS 上异步配置 UITableViewCells