简体   繁体   中英

Is there a notification for when a UIView's position in the window changes?

I have a custom UIView which is an accessibility container. Each of the UIAccessibilityElement s it houses has a frame, relative to the window. Because the frame is relative to the window, it needs to be updated whenever the position of the view in the window changes.

Is there a way to be notified when the position of the view in the window changes? This would allow me to keep all the code in this class, nice and reusable, instead of sprawling all over the view hierarchy.

Here Introduction to Key-Value Observing Programming Guide

KVO can monitor UIView's frame changed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM