Truncate text in a iOS text label after a maximum number of lines?

I have a series of Labels in my table rows, set to auto height (since there is something below and I want to close up any space). However, in the ase there is too much text, I don't want it to spill out of the table row… is there a way to have Max Lines and then ellipsize the text?

The SDK has an ellipsize property, but it says Android only.

SDK 1.7.2, OS 10.7, iPad 4.x

2 Answers

  • Setting an 'auto' height is going to allow the labels to grow to whatever height they need. Giving defined dimensions for your labels should allow you to truncate them appropriately.

  • Is there a maxheight? Because there are items beneath which I would like to move up if the text is very short.

    — answered 4 years ago by Steve Lombardi
    1 Comment
    • Please use comments in the future, makes the conversation easier to follow.

      If you want to dynamically change the height position of components based on runtime content, you'll likely have to manage that yourself. Your components that are set to 'auto' will have a value for their width and height in obj.size.width and obj.size.height when they are actually rendered to the screen. You can take advantage of this is the containing window's 'open' event.

      — commented 4 years ago by Tony Lukasavage