ios - How to get all allocated instances of specific class in Objective C? -
i trying implement component possibility apply different skins views , controllers @ runtime without reinitialising these controls. want use such logic:
- declare protocol methods applying skins.
- all necessary classes implements protocol.
- when user selects skin instances of classes conform protocol receive message apply skin.
so know how necessary classes conform specific protocol using objc_getclasslist
, class_conformstoprotocol
functions.
how allocated instances of these classes sending message them?
i know implemented internal logic of every class storing instances in static storage , returning array class method. isn't elegant solution. i'm finding more universal solution can add new skinnable controls in easy way.
it sounds you're reinventing <uiappearance>
. should @ least start there. it's it's for. see peter steinberger's writeup discussion of adding custom properties.
to basic question, there not runtime call enumerate allocated objects of class. add lot of overhead provide (objects come , go time , quickly). if it, shouldn't. since you're talking visible views, can enumerating view hierarchy under nswindow
. views not in view hierarchy should expected correctly redraw in new style next time come on screen.
but i'd start <uiappearance>
.
Comments
Post a Comment