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?

  1. should view itself? (in response property change)
  2. should controller managing view?
  3. 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

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -