-1

I've tried resizing it in Size Inspector > Row Height = 90

But once I run the app in the emulator, it crops the height to about 44

I can't happen to find a solution & also I've just started iOs development, I don't know what to do to resize the UITableViewCell

kevincodes_
  • 219
  • 4
  • 4

2 Answers2

1

By default, table view's use Automatic Dimensioning for row heights. If you cell is not designed with auto-layout / constraints that define its height, you need to explicitly set the height in code.

Easiest way to do that - assuming you want every row to have a height of 90-pts - is like this:

override func viewDidLoad() {
    super.viewDidLoad()
    tableView.rowHeight = 90
}
DonMag
  • 69,424
  • 5
  • 50
  • 86
  • It seems like the issue was that I didn't specify the cell identifier in the UItableViewCell in the storyboard, which in my TableViewController, in the tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) I named as cellIdentifier " MealTableViewCell ", so the program couldn't find the cell with this id, cause I didn't specify that in my storyboard – kevincodes_ Dec 05 '20 at 14:59
0

resizing depends on how you are creating table view cell, what kind of constraints you have applied to table view cell and another factor is the tableView(_:heightForRowAt:).

If you view layout requirements is satisfied with cell types provided by UITableViewCell class use those cells and use height as UITableViewAutomaticDimension.

if you need to implement your custom cell, make sure it implements auto layout.

Checkout following question for more detail: Using Auto Layout in UITableView for dynamic cell layouts & variable row heights

Manish Punia
  • 747
  • 4
  • 9
  • It's all because I'm a beginner I didn't know that I had to specify the cell identifier in the UITableViewCell in the storyboard for it to work, I figured out that adding the same Identifier I specified in my UITableViewController in dequeueReusableCell, would stop the crash – kevincodes_ Dec 05 '20 at 15:20