How to make fixed height cell on uitableview?

Ega Setya Putra

So I want to make timeline content like instagram, I'm using custom cell on my uitableview. My problem is I already set the cell height to 345 on the storyboard but I get cell table like below:

celltablescreenshot

and here is my custom cell on storyboard:

storyboardss

How can I fix it, so I can get the result like on my storyboard?

Natasha

The reason that you are having this issue is you have probably set your Custom tableview cell's row height to 345 but that is not set as custom while your UITableview's row height is less than 345. So, what you need to do is go to storyboard and select the Table(UITableview) and set its row height to the maximum possible row height.

enter image description here

Let's assume that you are going to have two different kind of row heights. One with 345 and another with 325. As 325<345, you set your tableview's row height to 345.

enter image description here

Now, select the custom tableview cell and make its row height as custom and set that to either 345 or 325. In your case, it will be 345.

enter image description here

It should be good now.

However, more appropriate way when you have different cell size would be to use the delegate method for row height specification.

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
   if(indexPath.row==0){
      return 345;
   }
   else if(indexPath.row==1){
      return 325;
   }
   else{
      return 300; //a default size if the cell index path is anything other than the 1st or second row.
   }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I make a div take up 100% of the height of a html table cell that doesn't have a fixed TD height?

From Dev

Static UITableView, make a single cell with dynamic height in Swift

From Dev

Get UITableView cell height

From Dev

Uitableview cell dynamic height

From Dev

How to change cell height dynamically in UITableView static cell

From Dev

bootstrap how to make a fixed height responsive?

From Dev

How to make Bootstrap Panel body with fixed height

From Dev

How can I make a table with a fixed width, but not a fixed height?

From Dev

How to make <a> in table cell height 100%?

From Dev

How to make custom cell height effective?

From Dev

How to make the cell height fit the screen

From Dev

How to programmatically increase UITableView cell's height in iPhone?

From Dev

UITableView: How to change cell height dynamically when a button is clicked in it?

From Dev

UITableView: How to change cell height dynamically when a button is clicked in it? Swift

From Dev

How to make list items of one UL with fixed height be displayed as columns?

From Dev

How can I make a fixed top menubar with a changing height in CSS?

From Dev

IOS UiTableView Cells how can I make it's height adjustable

From Dev

How to scroll to bottom of UITableView to see all cell contents without adjusting cell height?

From Dev

How to scroll to bottom of UITableView to see all cell contents without adjusting cell height?

From Dev

How to make div same height as parent (displayed as table-cell)

From Dev

How to make a table-cell have the same width as its height?

From Dev

UITableView with variable cell height: Working in IB but not programmatically

From Dev

UITableView inside UITableViewCell with dynamic cell height

From Dev

Set row height of a UITableView according to the cell in that row

From Dev

Set height of a specific cell in my UITableView

From Dev

How can I make these panels fluid with 100% height without giving fixed height

From Dev

how to add cell to uitableview

From Dev

Swift - UITableview: How to make a tap on one cell cause change a label in another cell?

From Dev

How to create a very basic UITableView programmatically with dynamic cell height and auto layout?

Related Related

  1. 1

    How can I make a div take up 100% of the height of a html table cell that doesn't have a fixed TD height?

  2. 2

    Static UITableView, make a single cell with dynamic height in Swift

  3. 3

    Get UITableView cell height

  4. 4

    Uitableview cell dynamic height

  5. 5

    How to change cell height dynamically in UITableView static cell

  6. 6

    bootstrap how to make a fixed height responsive?

  7. 7

    How to make Bootstrap Panel body with fixed height

  8. 8

    How can I make a table with a fixed width, but not a fixed height?

  9. 9

    How to make <a> in table cell height 100%?

  10. 10

    How to make custom cell height effective?

  11. 11

    How to make the cell height fit the screen

  12. 12

    How to programmatically increase UITableView cell's height in iPhone?

  13. 13

    UITableView: How to change cell height dynamically when a button is clicked in it?

  14. 14

    UITableView: How to change cell height dynamically when a button is clicked in it? Swift

  15. 15

    How to make list items of one UL with fixed height be displayed as columns?

  16. 16

    How can I make a fixed top menubar with a changing height in CSS?

  17. 17

    IOS UiTableView Cells how can I make it's height adjustable

  18. 18

    How to scroll to bottom of UITableView to see all cell contents without adjusting cell height?

  19. 19

    How to scroll to bottom of UITableView to see all cell contents without adjusting cell height?

  20. 20

    How to make div same height as parent (displayed as table-cell)

  21. 21

    How to make a table-cell have the same width as its height?

  22. 22

    UITableView with variable cell height: Working in IB but not programmatically

  23. 23

    UITableView inside UITableViewCell with dynamic cell height

  24. 24

    Set row height of a UITableView according to the cell in that row

  25. 25

    Set height of a specific cell in my UITableView

  26. 26

    How can I make these panels fluid with 100% height without giving fixed height

  27. 27

    how to add cell to uitableview

  28. 28

    Swift - UITableview: How to make a tap on one cell cause change a label in another cell?

  29. 29

    How to create a very basic UITableView programmatically with dynamic cell height and auto layout?

HotTag

Archive