Search code examples
iphoneuilabeltabbing

How can I remove tab spacing from text for UILabel


I'm reading some text from a local xml file and displaying it in a UILabel. The text in the xml initially had tabbed spacing in it. I removed this tabbing manually in the editor but it's still showing up in the UILabel and it makes the text layout look very messy.

How can I resolve this?


Solution

  • Try with below

    myLabel.text = [myText stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet];