I would like to be notified whenever a certain NSView‘s - (NSRect)visibleRect changes because I want to do some fancy subview layout based on the visible rect. Frankly, right now I’m stumped; -visibleRect doesn’t emit KVO notifications (which makes sense), and there doesn’t seem to be way to find out if the visible rect changed or not without explicitly calling -visibleRect.
Is this at all possible? (or is it a terrible, terrible idea?)
I think you can either override
-[NSView updateTrackingAreas]or listen forNSViewDidUpdateTrackingAreasNotification. Those may happen on more occasions than just a change of the visible rect, but they should happen for any change of the visible rect. I think.That said, it may be a terrible idea. Hard to know. 🙂