Questions tagged [heightforrowatindexpath]
127 questions
100
votes
18 answers
iOS8 - constraints ambiguously suggest a height of zero
Has anyone got any idea how to debug this?
Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view. We're considering the collapse unintentional and using standard height…

Chris
- 2,727
- 2
- 27
- 28
42
votes
10 answers
Iphone - when to calculate heightForRowAtIndexPath for a tableview when each cell height is dynamic?
I have seen this question asked many times but astoundingly, I have not seen a consistent answer, so I will give it a try myself:
If you have a tableview containing your own custom UITableViewCells that contain UITextViews and UILabels whose height…

JohnRock
- 6,795
- 15
- 52
- 61
27
votes
6 answers
how to obtain the UITableViewCell within heightForRowAtIndexPath?
How does one obtain the UITableViewCell when within the heightForRowAtIndexPath method, i.e. given the indexPath?
(then I could access the content views I have created to add their heights up)
- (CGFloat)tableView:(UITableView *)tableView…

Greg
- 34,042
- 79
- 253
- 454
11
votes
4 answers
heightForRowAtIndexPath being called for all rows & how many rows in a UITableView before performance issues?
I thought I had read that for a UITableView that heightForRowAtIndexPath doesn't get called on all rows, but only on the ones that will be visible. This isn't what I'm seeing however. I'm seeing hundreds of calls to heightForRowAtIndexPath for the…

Greg
- 34,042
- 79
- 253
- 454
11
votes
2 answers
estimatedHeightForRowAtIndexPath can in fact change the final "correct" height of a row?
I've just discovered an astounding problem or counter-intuituve behaviour when using estimatedHeightForRowAtIndexPath
(1) My table has wildly varying row heights. The final results can range from 111 to about 400.
(2) I absolutely perfectly…

Fattie
- 27,874
- 70
- 431
- 719
9
votes
2 answers
The best way to calculate UITableViewCell height without contentView frame
SUMMARY
Given that we don't always know what the frame of a cell or its content view is going to be (due to editing, rotation, accessory views etc.), what is the best way to calculate the height in tableView:heightForRowAtIndexPath: when the cell…

Valentyn Kuznietsov
- 543
- 5
- 14
8
votes
3 answers
How to reload tableview after reordering a row? Rows have variable height
I let user to reorder rows in tableView. Because this event affects content - some numeric values in cells should be updated - in all the other rows, I call a reloadData in moveRowAtIndexPath. And then strange effects occur.
I.e. cells seems…

János
- 32,867
- 38
- 193
- 353
8
votes
3 answers
iOS - Redraw TableViewCells with Dynamic Cell heights on rotation
How can I go about getting my cells to redraw once the device is rotated?
When I am testing on iPhone, the default orientation is portrait, so my dynamic cells are as tall as they need to be when the device is in portrait orientation: this means…

Eichhörnchen
- 592
- 2
- 12
- 27
7
votes
2 answers
UITableView separators drawn incorrectly through cell reuse?
I'm working on an iOS 5 project with storyboards, and thus using dynamic table cell prototypes in IB. In one of the views, I've got a table view with variable-height cells, with the cell height calculated from the height of the…

JK Laiho
- 3,538
- 6
- 35
- 42
7
votes
4 answers
TableView - heightForRowAtIndexPath not being called
After going through all of the other Stack Overflow forms, I have implemented a dynamic height for one of my cells as follows:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cell =…

Code Wiget
- 1,540
- 1
- 23
- 35
7
votes
3 answers
UITableViewCell frame height not matching tableView:heightForRowAtIndexPath:
I'm constructing a UITableView with variable height custom table cells, their height determined by the size of a contained multi-line UILabel. I've got the tableView:heightForRowAtIndexPath: delegate method wired up and calculating the final height…

JK Laiho
- 3,538
- 6
- 35
- 42
6
votes
3 answers
Load custom UITableViewCell from Storyboard
Currently I'm using auto layout with storyboard to dynamically resize custom UITableViewCell's. Everything is working as it should except there is memory leak when scrolling.
I know the problem is from calling
[self.tableView…

Iki
- 175
- 1
- 1
- 6
5
votes
3 answers
Hide a UITableView by setting row height to 0?
I just inherited code which hides/shows rows a UITableView by using the delegate heightForRowAtIndexPath method and returning height 0 for "hidden rows".
The code works, but it has me concerned there might be fraught with unforeseen complications.…

DBD
- 23,075
- 12
- 60
- 84
5
votes
2 answers
how do I calculate heightForRowAtIndexPath when the cell is not even constructed yet?
Question - How does one best calculate the height for a row in the "heightForRowAtIndexPath" method of a UITableViewController, given that:
I'm using a custom subclassed UITableViewCell & the actually size of the subview (e.g. UILabels) is…

Greg
- 34,042
- 79
- 253
- 454
5
votes
1 answer
UITableViewCell frame height is always 44px
I am setting the height of cell using heightForRowAtIndexPath: method returning 100.
But in cellForRowAtIndexPath method, the cell's frame height is always 44px.
Following is my code.
- (CGFloat) tableView:(UITableView *)tableView…

Dhawal
- 185
- 2
- 11