ios - Dynamic number of UIViews in custom UIView -


i'm making custom uiview. holds bunch of uilabel objects subviews. count of uilabel objects unknown @ creation time. method in should initialize these uilabel objects? drawrect suitable job?

no, drawrect: not suitable. drawrect: drawing content of view, not modifying subviews of view. should update based on triggering event - perhaps viewdidload, viewwillappear:, or user event them pushing button. if triggering event on background thread need switch main thread before adding new labels subviews.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -