简体   繁体   English

如何在UILabel中尾部截断某些文本

[英]How to tail truncate some text in UILabel

How to truncateTail the text (First 3 letters and dots). 如何截断文本尾部(前3个字母和点)。

I want to show partial text in textfield and UILabel as well ie (First 3 letters and dots). 我也想在textfield和UILabel中显示部分文本,即(前3个字母和点)。 For example Universe should be shown as Uni...... I have searched over internet and found many solutions like some are using truncateTail but none of them are fullfilling my requirement. 例如,Universe应该显示为Uni ......我已经在互联网上进行搜索,发现许多解决方案,例如某些正在使用truncateTail,但没有一个能够满足我的要求。 Need any idea to achieve this functionality. 需要任何想法来实现此功能。

How to tail truncate some text in UILabel 如何在UILabel中尾部截断某些文本

It is very easy to implement it. 实施起来非常容易。

string oldStr = "Universe";

NSString newStr = new NSString(oldStr.Substring(0,3)+"......");

label.Text = newStr;

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

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