0

My design looks like a table cell. But I only have two "cells" so i decided to draw them using UIViews with a height of 1 so that I looks like a straight line.

But what I now want to do is to make one of the "cells" touchable so when you tap the cell it should expand and show a few more UILabels listing more information.

Should I code this based on my current way with the UIView, or os there a better way to do it using cells or whatever?

I only went with UIView because I only have two "cells"

Race B
  • 1,193
  • 1
  • 8
  • 7
Kiwo Tew
  • 1,491
  • 1
  • 22
  • 39

2 Answers2

2

Table views are useful for showing long lists or dynamic content. If you have 2 fixed items, you could then do it by hand without the overhead of the UITableView.

Nevertheless, if you have to make the cells expandable, you may as well decide to leverage the methods defined for the UITableView to add the behaviour you described. Look at this thread.

It's up to you. More overhead to implement the UITableView protocols to have an easier expandable behaviour, or simpler UIViews at the price of adding expandability by hand.

Community
  • 1
  • 1
Nicola Miotto
  • 3,647
  • 2
  • 29
  • 43
1

@Nicola Miotto is right about having expandable cells but I would like to add a little more to it. Using UIViews in place of UITableViewCells is not a smart concept. You won't have the convenience of the delegate and data source; also, you might end up having to do more work. It sounds like you only want to see 2 cells. Find out how to get rid of the empty cells here How to remove empty cells in UITableView?

Community
  • 1
  • 1
suntzu
  • 65
  • 3
  • 13