I have dragged a UITableView
into my storyboard and I can fully insert info into it. But in order to customise the cell I added a prototype cell. When I change the height of it manually nothing changes in the simulator.

- 484,302
- 314
- 1,365
- 1,393

- 1,044
- 4
- 18
- 51
-
3implement method heightForRowAtIndexPath and return height as per your requirement. – Yagnesh Dobariya Sep 27 '17 at 03:30
4 Answers
For those who come here just wanting to change the row height during design time, you can select the Table View Cell and then set the row height in the Size inspector.
I'm adding this answer because I found this question when I was having trouble manually dragging the cell height to something else. As the OP noted, though, this will not change the cell height at run time. The cell is auto-sized depending on its content. If you need to give it a fixed height, see the accepted answer.

- 484,302
- 314
- 1,365
- 1,393
You can change the height of a cell by adding Constraints to your label inside the cell or otherwise by adding this to your viewDidLoad
:
tableView.rowHeight = 40
Or you may add the following delegate function to change the height:
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 40
}

- 481
- 3
- 16
-
-
@Jonas you can do in storyboard by clicking on the cell and then change the row height value under size inspector. – Ali Jun 30 '18 at 00:30
-
4I tried that but that shows up only in the storyboard itself but when testing in the emulator it didn't change it – Jonas Jun 30 '18 at 08:06
-
2@Jonas -> You need to click on the table view in the Storyboard, then click on the "Size inspector" on your right toolbar (looks like a measuring ruler) and you will see under "Table View" a property called "Row Height", make sure "Automatic" isn't checked and change it there. Try that and see if it works. [XCode Version 11.3.1] – TSuperman Mar 20 '20 at 19:29
You can use tableView delegate method and specify the value for your heightForRowAt
say you want it to be 80:
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return CGFloat(80)
}

- 589
- 2
- 6
- 14
The accepted answer wasn't working for me. What did work for me was adding the tableview rowheight under the following delegate:
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{
tableView.rowHeight = 350

- 1,048
- 11
- 13