Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fail to hide empty cells in UITableView Swift

Tags:

I'm using UITableView in a swift application, and using my own custom UITableViewCell.

When trying to hide the empty cells in the UITableView, its still have the white background.

Under the UITableView I have a background image (UImageView).

I'v already try to hide those cells, and actually they are hidden, but I still have a white background, using this code:

override func viewDidLoad() {     super.viewDidLoad()     var tblView =  UIView(frame: CGRect(x: 0,y: 0,width: 0,height: 0))     tblView.backgroundColor = UIColor.clearColor()     tableView.tableFooterView = tblView      var nipName=UINib(nibName: "CustomCell", bundle:nil)     self.tableView.registerNib(nipName, forCellReuseIdentifier: "CustomCell") } 
like image 358
user3210784 Avatar asked Jun 28 '14 20:06

user3210784


1 Answers

A cleaner solution is:

tableView.tableFooterView = UIView(frame: CGRectZero) 

Nothing else is needed.

like image 101
Profezy Avatar answered Sep 28 '22 14:09

Profezy