I have a UITableViewCell subclass with backgroundView set to my own UIView object. This UIView object contains three CALayer layers. I implemented - (void)layoutSubviews where I update all my CALayer layers. The problem is autorotation.
When I rotate from landscape to portrait mode there’s this cosmetic issue:
During the animation, all my CALayer layers are as narrow as in portrait mode.
It seems that this guy is right:
When
layoutSubviewsgets called during an orientation change, the view’s bounds are already set to what they will be at the conclusion of the rotation.
So, where should I update my layers to achieve proper autorotation? The view is already rotating them, so I suppose there’s no need to do any custom animations, just adjust the size. Right?
Figured it out:
CALayer+ add sublayers into itCALayer‘s- (void)layoutSublayersmethodsubclass
UIView+ override+ (Class)layerClassin it:set the subclassed
UIViewasbackgroundViewofUITableViewCell