ios - UIView - resize to fit contents -
i have created subclass of uiview has property
@propert (nonatomic, copy) nsarray *tags; the tags array contains list of strings view should display. view should adjust size according number of tags displays. should responsible adjusting view's size?
- should view itself? (in response property change)
- should controller managing view?
- should controller managing view ask current size? (after setting tags property)
superview responsible placement of subviews. in scenarios size of subview can vary static size specified superview. in such cases superview can relayout. each subview queried sizethatfits: return precise size.
so, override sizethatfits: method in subview , return dynamic size required view precisely fit content/subviews.
Comments
Post a Comment