Reputation: 33090
Is it possible?
Basically I want to show address of a restaurant. It could be in label or text view. However I need that label or text view to be multiline. Can I do so with label?
Also if user click on address they should be able to add the biz into their contact.
How would I do so because textView doesn't seem to capture any action?
Upvotes: 0
Views: 382
Reputation: 5540
you can use the uilabel's property called label.numberOfLines=someNumber;if you need any clarification ask me freely
Upvotes: 1
Reputation: 44633
You can use a label. UILabel
supports multilines through the property numberOfLines
. Say your address is in an NSArray
. You can do this –
// address is the array
// addressLabel is the label that needs to be updated.
addressLabel.numberOfLines = [address count];
addressLabel.text = [address componentsJoinedByString:@"\n"];
This should do it. Make sure you have allocated a proper frame for this. If there are a lot of lines, you can consider putting it in a UIScrollView
.
Upvotes: 1