marciokoko
marciokoko

Reputation: 4986

How do I make text in a UILabel wrap around a certain character?

I have a UILabel being populated from data from a database. The data comes in like this:

LV:7:00 AM - 10:00 PM,S:7:00 AM - 10:00 PM,D:9:00 AM - 10:00 PM

I want it to wrap around the comma so the UILabel looks like this:

LV:7:00 AM - 10:00 PM, 
S:7:00 AM - 10:00 PM,
D:9:00 AM - 10:00 PM

Upvotes: 0

Views: 656

Answers (2)

marciokoko
marciokoko

Reputation: 4986

I figured it out. I hadnt set the UILabel to more than 1 line.

Upvotes: 0

EricS
EricS

Reputation: 9768

Try:

myLabel.text = [myString stringByReplacingOccurrencesOfString:@"," withString:@",\n"];

Upvotes: 4

Related Questions