Jochen
Jochen

Reputation: 7531

Calling -[UIView layoutSubviews] during a custom animation like UIScrollView does

when UIScrollView is scrolling animated (e.g. with setContentOffset:animated:), it periodically calls its layoutSubviews, where subclasses can adjust the layout.

I now want to do something similar with a custom view and a custom animation (+[UIView begin/commitAnimations]). I know I can get the current bounds from the CAlayer's presentation layer, however I do not know how to hook into the animation to be able to periodically call layoutSubviews.

Any help is appreciated.

Thanks, Jochen

Upvotes: 4

Views: 944

Answers (1)

EricD
EricD

Reputation: 551

In your custom view, can you overide setFrame like this ?

- (void) setFrame:(CGRect)rect 
{
    [super setFrame:rect]
    [self layoutSubviews];
}

Upvotes: 1

Related Questions