0

i'm writing a small app to train myself and i need a little help.

can anyone give me an advice how to make this construction like on the picture bellow? i'm interested about "Description" section. i want to make the similar thing in my app. some text in preview..button "more" and when i click it the whole text will appear on the screen. also i want to have the same button "hide" that returned me to the preview. i need UITextView or smth else?

http://savepic.net/3943823.htm

vikingosegundo
  • 52,040
  • 14
  • 137
  • 178
Jateko
  • 61
  • 1
  • 6
  • Use a `UILabel`. `UITextView` is for entering text, not displaying it. – rmaddy Oct 23 '13 at 23:24
  • UILabel is definitely the easiest way to go. However if you do need a UITextView, which not only allows editing, but also can discover links, addresses, times, phone numbers etc automatically and turn them into clickable have a look at his: http://stackoverflow.com/questions/18368567/uitableviewcell-with-uitextview-height-in-ios-7/18818036#18818036 – Tim Bodeit Oct 23 '13 at 23:47

1 Answers1

0

rmaddy is right, UILabel is the way to go.

You need to hide the More button, and show a Hide (or Less?) button and the label when the user taps. You also need to change the row's height to accomodate for the new content.

To find the appropriate height for the table's row, use either [UILabel sizeToFit] or [UILabel sizeThatFits].

To animate the height change of the row, have a look at Can you animate a height change on a UITableViewCell when selected?

Community
  • 1
  • 1
Khanh Nguyen
  • 11,112
  • 10
  • 52
  • 65