uiview - how to detect interface changes on iOS application -
is there possible way detect every change on user interface during runtime??
i'm trying find objects in current app interface.
i'm trying to nodes inspecting recursively main window, but, example, how know if top viewcontroller changes or if it's added uiview dynamically, or presented modalview??
the main objective have library this..
any idea, help?
thanks!
you write own library based on this, using advanced objective-c techniques. not recommend this, since breaks mvc patterns on ios. depends on want use for, maybe analytics?
so these options believe, if want actively inspect uiview
hierarchy. options pretty complicated though.
swizzle methods such
addsubview
,removefromsuperview
ofuiview
, know when changes happens. including getters of frame , bounds, if wish know position.you use kvo watch properties such as:
subviews
,frame
,bounds
,superview
notice changes. @ 1 point have add same object observer (could singleton).decide interval fired a
nstimer
, go through hierarchy recursively beginning @keywindow
onuiapplication
. have big performance impact though.
there may other options, these ones believe best choices.
Comments
Post a Comment