user4951
user4951

Reputation: 33090

Capturing Touch Up Event in TextView

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

Answers (2)

Tendulkar
Tendulkar

Reputation: 5540

you can use the uilabel's property called label.numberOfLines=someNumber;if you need any clarification ask me freely

Upvotes: 1

Deepak Danduprolu
Deepak Danduprolu

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

Related Questions