开发者

UIView frame change Notification

开发者 https://www.devze.com 2023-03-08 16:16 出处:网络
Is there any notification when frame or bounds of UIView changes? Whenever frame of a UIView changes, I need to calculate and set the fram开发者_运维问答e of its custom subview so that it aspect fits

Is there any notification when frame or bounds of UIView changes? Whenever frame of a UIView changes, I need to calculate and set the fram开发者_运维问答e of its custom subview so that it aspect fits in the superview.

NSView has the notification NSViewFrameDidChangeNotfication for the purpose. Why is this not there for UIView?


There is no notification. You can subclass UIView to override layoutSubviews, to either do the layout directly or send the necessary notification.

Have you tried setting an appropriate autoresizingMask so the subview gets resized automatically?

0

精彩评论

暂无评论...
验证码 换一张
取 消