Reputation: 6836
In my tableview, I replace my default UILabel with a different UIView on tap, and then replace it back with an archived version of the UILabel when the picker is ready to be dismissed. The UILabel does change contents in the process, as well.
The result is that the UILabel is seen to shift right when the cell resizes. You can see the result here in video:
I've tried messing with the constraints, and if I explicitly set the frame to be in the right place, it'll work, but only after the first time. If it helps, it also seems to place itself so that the text is centered in the middle of where the UILabel was placed (as though the text was centered in a larger UILabel), but upon inspection, it's the frame.origin.x
of the UILabel that's at fault.
Any thoughts? I feel like this has something to do with the constraints system, but nothing I did with them seemed to have any impact.
Upvotes: 0
Views: 108
Reputation: 5845
I find that the best way to implement this is two use two cells. One has the label the other the picker. I keep both visible while the picker is open which is how apple does it in the calendar app. If you want to do it all one cell why don't you play with the height of the cell and the alpha of the label so you don't have to do any replacing?
Upvotes: 1