简体   繁体   English

使用Storyboard设置UILabel之类的UITextView的最大行数?

[英]Use Storyboard to set maximum number of lines for UITextView like UILabel?

In Storyboard, is it possible to set the maximum number of lines in a UITextView similar to how you can with a UILabel ? 在情节提要中,是否可以像使用UILabel设置UITextView的最大行数? All the other SO posts only show programmatic solutions. 所有其他SO帖子仅显示编程解决方案。

You can do it with User Defined Runtime Attributes for this view. 您可以User Defined Runtime Attributes此视图的User Defined Runtime Attributes来完成此操作。 Select your UITextView , open Identity inspector , and add new attribute. 选择您的UITextView ,打开“ 身份检查器” ,然后添加新属性。 Enter textContainer.maximumNumberOfLines to key path , select Number as type and put your number to Value field. 输入textContainer.maximumNumberOfLineskey path ,选择Number作为类型并将您的数字放入Value字段。

在此处输入图片说明

First of all make Text as "Attributed" and then select button which is shown in below image.. 首先,将文本设置为“已归因”,然后选择按钮,如下图所示。 在此处输入图片说明

It may be helpful to you.. Thanks.. 这可能对您有帮助..谢谢..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM