0

I need to build a fairly detailed home screen for a IOS app and I'm fairly new to IOS dev. it basically contains -

  • Styled button which displays important message count and a link to messages area.
  • a iCarousel slider which shows styled stat info
  • a tableview with several dynamic custom classes.

All of which are wrapped with a UIScrollView - my issue is I dont know a method of working out the compiled height of the UIScrollview - Is it possible to give it an autoheight? If not how do I go about generating a height and applying it to the UIView?

Dancer
  • 17,035
  • 38
  • 129
  • 206

1 Answers1

1

Is it possible to give it an autoheight? If not how do I go about generating a height and applying it to the UIView?

Yes, you can use it with Auto Layout. See the section "Pure Auto Layout Approach" at UIScrollView And Autolayout. UITableView is also a scroll view, so you will have to add a height constraint to it - the height can be calculated with sizeThatFits:.

Arek Holko
  • 8,966
  • 4
  • 28
  • 46
  • cheers @Arkadiusz Holko - the UITableView will be the dynamic element - there could be 5 or 15 cells applied depending on certain factors - will this approach allow for that? – Dancer Oct 17 '13 at 14:59
  • @Dancer: yes, though you'll have to change the constraint's `constant` when the number of elements changes. [This question](http://stackoverflow.com/questions/19360303/uicollectionview-not-calling-intrinsiccontentsize/) may also help you - here we've tried to use `intrinsicContentSize`. – Arek Holko Oct 17 '13 at 15:08