Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19357] iOS: Add Ellipsize support for AttributedString

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-08-25T15:06:24.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.0.0
ComponentsiOS
LabelsattributedString
ReporterChee Kiat Ng
AssigneeEric Merriman
Created2015-08-17T04:58:52.000+0000
Updated2017-03-21T19:26:57.000+0000

Description

Refer to this link http://iosdevelopertips.com/user-interface/truncate-string-adding-ellipsis-at-front-middle-or-end.html

Comments

  1. Shawn Lipscomb 2015-08-17

    Android and mobileweb support the ellipsize property of Ti.UI.Label directly, without having to use the AttributedString property. Please add support for ellipsize under iOS as well, as requested in TIMOB-13398, which was resolved as a duplicate of this ticket. I don't really think these are exact duplicates.
  2. Neville Dastur 2015-08-17

    May I suggest that closing an old ticket for a duplucate is not the most helpful thing. All the old history / suggestions and watchers are on the older ticket number
  3. Shawn Lipscomb 2015-08-18

    ^ I agree. The old ticket was not an exact duplicate anyway. I think it should be reopened.
  4. Chee Kiat Ng 2015-08-24

    PR here: https://github.com/appcelerator/titanium_mobile/pull/7062
  5. Hans Knöchel 2015-08-24

    [~cng] Can you provide demo code?
  6. Chee Kiat Ng 2015-08-25

    Sample code here:
       var win = Titanium.UI.createWindow({
           backgroundColor: '#ddd',
       });
       
       win.open();
       
       var text =  'Bacon ipsum dolor Appcelerator Titanium rocks! sit amet fatback leberkas salami sausage tongue strip steak.';
       
       var attr = Titanium.UI.createAttributedString({
           text: text,
           attributes: [
               {
                   type: Titanium.UI.ATTRIBUTE_LINE_BREAK,
                   value: Titanium.UI.ATTRIBUTE_LINE_BREAK_BY_WORD_WRAPPING,
       //            value: Titanium.UI.ATTRIBUTE_LINE_BREAK_BY_CHAR_WRAPPING,
       //            value: Titanium.UI.ATTRIBUTE_LINE_BREAK_BY_CLIPPING,
       //            value: Titanium.UI.ATTRIBUTE_LINE_BREAK_BY_TRUNCATING_HEAD,
       //            value: Titanium.UI.ATTRIBUTE_LINE_BREAK_BY_TRUNCATING_TAIL,
       //            value: Titanium.UI.ATTRIBUTE_LINE_BREAK_BY_TRUNCATING_MIDDLE,
                   range: [0, text.length]
               }
           ]
       });
       
       var label = Titanium.UI.createLabel({
           left: 20,
           right: 20,
           height: 30,
           attributedString: attr
       });
       
       win.add(label);
       
  7. Hans Knöchel 2015-08-25

    PR approved & merged!
  8. Lee Morris 2017-03-21

    Closing ticket as fixed.

JSON Source