Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 UILabel 最多可以显示 2 行文本。我没有使用自动布局。在 IB 中,我将“lines”属性设置为 2。如何获取 Obj-C 中显示的行数?
简而言之:调用 UILabel 的sizeWithFont :,然后除以字体的lineHeight。