UILabel - 当文本长度超过一定长度时显示....

use*_*878 1 iphone nsstring uilabel ios

我已经放入UILabel了我的应用程序,因为我希望在文本长度超过一定数量时显示文本....

因为如果文本更长,它会给出设计问题.

请告诉我们使用哪种功能.

Neo*_*Neo 5

试试这个

yourLabel.lineBreakMode=UILineBreakModeTailTruncation;
Run Code Online (Sandbox Code Playgroud)

如果要从界面构建器添加UILabel,则可以直接执行此操作.选择 UILabel并在Attriubtes Inspector的 = Utilities列中>> Label section => Line Breaks set Truncate Tail