Eliko
Eliko

Reputation: 1137

How to delete the empty cells that i don't use in Swift

I have got a toEat array:

var toEat = ["apple"]

In addition, the user can add more fruits to the array while running the app, for example:

var toEat = ["apple", "banana"]

The array has nothing more except apple and banana, so why when I run the app I get empty cells? How can I delete it?

enter image description here

Upvotes: 0

Views: 45

Answers (2)

Nishant
Nishant

Reputation: 12617

    self.tableView.tableFooterView = UIView(frame: CGRectZero)

Upvotes: 2

mkz
mkz

Reputation: 2302

You can try this line of code:

self.tableView.tableFooterView = UIView(frame: CGRectZero)

Upvotes: 5

Related Questions