Call - [UIView layoutSubviews] during custom animations such as UIScrollView

when a UIScrollView scrolls animated (e.g. with setContentOffset:animated: , it periodically calls its layoutSubviews , where subclasses can customize the layout.

Now I want to do something similar with custom view and custom animation ( +[UIView begin/commitAnimations] ). I know that I can get the current borders from the CAlayer view level, however I don’t know how to connect to the animation in order to be able to call layoutSubviews periodically.

Any help is appreciated.

Thanks Jochen

+4
source share
1 answer

In your custom view, you can override setFrame as follows:

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

Source: https://habr.com/ru/post/1341254/


All Articles