Do you have any custom views that override -layoutSubviews
?
In my experience, this means you have a view that does custom layout using -layoutSubviews
but does not call -setNeedsLayout:
at the appropriate times; in general setting the frame does not force a layout (auto-layout is handled differently).
In any view that overrides -layoutSubviews
, try the following:
-(void)setFrame:(CGRect)frame
{
CGRect oldFrame = self.frame;
// This check changes behaviour slightly:
// v.frame = v.frame;
// no longer cancels animations.
// Sometimes this works around an animation glitch.
if (!CGRectEqualToRect(frame,oldFrame))
{
[super setFrame:frame];
if (!CGSizeEqualToSize(frame.size,oldFrame.size))
{
// Only layout if the size changes.
[self setNeedsLayout];
}
}
}
(You could do the same for -setBounds:
but it's generally unnecessary since AFAIK it doesn't get called by UIKit except for UIScrollView
.)