简体   繁体   中英

How to tail truncate some text in UILabel

How to truncateTail the text (First 3 letters and dots).

I want to show partial text in textfield and UILabel as well ie (First 3 letters and dots). 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. Need any idea to achieve this functionality.

How to tail truncate some text in UILabel

It is very easy to implement it.

string oldStr = "Universe";

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

label.Text = newStr;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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