cristan lika cristan lika - 5 months ago 25
iOS Question

How to make 3 row full scene how UITableViewCell occupy the complete screen?

I am loading cell from nib (xib) tableviewcell

//tabelview cell register

let nib: UINib = UINib(nibName: "ItemTableViewCell", bundle: nil)

tableViewItemList.register(nib, forCellReuseIdentifier: "ItemTableViewCell")

I have spent of very long time to solve this problem but I could not find any solution.

I need to show 3 rows of tableView and those three rows must occupy my screen. Currently, it is showing three rows but there is some extra white space remaining which I want to occupy by those rows.

enter image description here

above is the screen I obtained. below is the design that I want to achieve.

enter image description here


Use following functions of UITableViewDelegate:

func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
    return tableView.frame.height/3

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
    return tableView.frame.height/3