mindz-eye / MYTableViewIndex

A pixel perfect replacement for UITableView section index, written in Swift
MIT License
523 stars 52 forks source link

Labels sometimes disappear #21

Closed hipwelljo closed 6 years ago

hipwelljo commented 6 years ago

I'm seeing an issue where the labels sometimes disappear, have you seen that before?

It occurs for me in a few different scenarios, like when I bring up the keyboard on iPad in portrait (which doesn't cause the truncation to occur because they all fit on screen) then rotate to landscape (where not all fit on screen so it has to truncate). A lot of the labels disappear, but their frame is preserved so there's space for each but they're not all visible. When I then dismiss the keyboard it expands out to show all but a few labels are not visible. What's interesting is the View Debugger shows the missing labels don't exist as subviews, they're not there at all.

I've been trying to debug it but haven't been able to figure out why this is occurring. It seems to be an issue when the height changes, it calls layoutSubviews in the index view a few times with different heights, but the last one is always correct, yet it ends up not properly creating all the subviews it seems. Or maybe a race condition removing and re-adding? I'm not sure. Hoping you might know where the problem may lie.

img_0336 img_0337 img_0338

hipwelljo commented 6 years ago

Aw, the problem is resolved by removing everything in the removeItem(_:) func except item.removeFromSuperview().

mindz-eye commented 6 years ago

Good point, thanks! I'll take a look