Syed Ariff
Syed Ariff

Reputation: 732

Tableview Cell size not changing? Swift

I dragged an dropped a table view Controller from the object library and changed the cell's row height to 300.However , when I run it in the simulator , the cell remains the same standard size.Why is this?

Images : enter image description here enter image description here

Constraints : enter image description here

Output : enter image description here

Upvotes: 4

Views: 10174

Answers (4)

Sateesh Pasala
Sateesh Pasala

Reputation: 968

  1. Make sure you have given all the constraints in the cell . They have to be connected from top to bottom.

  2. Make sure that the class of content view inside the custom cell is UIView .(I have done the same mistake )

    press content view -> see identity inspector on right -> class should be UI view . custom cell elements

Upvotes: 1

SwiftDeveloper
SwiftDeveloper

Reputation: 7370

You can set custom row height example add ;

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat 
{
    return 100.0;//Your custom row height
}

Upvotes: 3

Kádi
Kádi

Reputation: 2906

In Storyboard, if you know the cell height, set the Table View's Row Height property on the Size Inspector tab, not the cell's:

UITableView's Size Inspector page

Upvotes: 21

Ruchira Randana
Ruchira Randana

Reputation: 4179

Use the delegate of the tableview and set the heightforrowatindexpath method.

Upvotes: 0

Related Questions