Using autosizing UITableViewCells and they work fine except occasionally on rotation when a cell will suddenly be too tall or something until it's scrolled off screen and back.

@bigzaphod I’d be happy to have a look if you like. I’ve dealt with that kind of weirdness before.

@sgoodwin what should I look for? There's a couple stack views in here - which I'm suspicious about.


@bigzaphod yeah that can do it. Is there showing/hiding happening with them per cell?

@sgoodwin I have a vertical stack view where I set isHidden on one of the views to show/hide it when the cell is first setup. This seems to work okay right up until I rotate and then i'm pretty sure it's reusing a cell that was previously taller, setting new content, and for whatever reason, constraints don't update or something maybe.. and it leaves the cell too tall.

@bigzaphod where do you update these properties? Maybe you need a prepare for reuse.

@bigzaphod @sgoodwin I had this problem in a Mac app when resizing cells and a stack was causing it to not get shorter. I think it was due to not having a required vertical content hugging priority or something like that.

@tgaul @sgoodwin I've tried things like setting content hugging priority to 1000 everywhere but it still seems to happen. Was it intermittent? Sometimes I have to scroll around and rotate the device 15-20 times before it'll mess up. I have no idea what exactly is triggering it - but probably something with cell reuse. Maybe.

@bigzaphod @sgoodwin Actually, now that I think about it more, I recall that it was happening when I had a horizontal stack inside the vertical stack. I had to change something about the setup of the horizontal stack to fix it. Of course, NSStackView and UIStackView are somewhat different, so it might not be the same issue on iOS (or you might not be using both like I was).

@tgaul @sgoodwin that sounds awfully familiar... I have a vertical stack view that has a horizontal stack view in it. Hmm.

@bigzaphod @sgoodwin Yeah, in that case, make sure your horizontal stack has a very low compression resistance and a high content hugging.

@bigzaphod @sgoodwin I'd recommend reproducing it, and then using the view debugger to see if you can find out if there's a view taking more space than it should be. That's how I found the horizontal stack in my case.

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!