1

I have added a static table view to my storyboard. In the tableview there are 3 static cells.

enter image description here

When i run this in simulator i get this:

enter image description here

As you can see i get too many rows now. Why? Isn't it suppose to be static as in displaying 3 rows as in the storyboard?

Lord Vermillion
  • 5,264
  • 20
  • 69
  • 109

3 Answers3

3

Update :

For people that wants to keep separator but not those extra ones after the cells ends do this :

Objective C :

self.tableView.footerView = [[UIView alloc]initWithFrame:CGRectZero];

Swift 3.0+

tableview.tableFooterView = UIView(frame: .zero)

Also, after this you do not need to remove separators, you can keep them, as it is.

Original Answer :

Those are not Static cells they are the Separators generated by the tableview.

For your confusion i tried the same thing with the static cells each having a background colour and this is what i got

enter image description here

Hence i can say is that those arnt cells, they are the separators which are making it appear as if there are cells to it. Check the separators to nil to make the effect go away.. Here enter image description here

And then this is what i get

enter image description here

Community
  • 1
  • 1
Saheb Roy
  • 5,899
  • 3
  • 23
  • 35
  • I want separators for my cells tho, but only for the 3 cells ive added. Is this possible? – Lord Vermillion Sep 08 '15 at 09:09
  • You can add a `view` with height 1 and a background colour of your desire inside the 3 cells and turn off separators. That will create the desired effect – Saheb Roy Sep 08 '15 at 09:45
0

By default, UITableView show empty cell with separate line. They are empty cells. You can hide them by following topic Eliminate extra separators below UITableView

Community
  • 1
  • 1
tuledev
  • 10,177
  • 4
  • 29
  • 49
  • I want to design my tableview and cells in storyboard, i thought that was what u did with a static table view, do i really have to use delegate methods? – Lord Vermillion Sep 08 '15 at 08:54
0

This is a common problem, not for just static tableviews. You need to add a blank tableview footerView. Swift:

tableView.tableFooterView = UIView()

xaphod
  • 6,392
  • 2
  • 37
  • 45