I want a 2-page horizontally scrolling UIScrollView on a simple
UIViewController. Very similar to what Twitter does to swipe between Home,
Discover and Activity views.

Using storyboards, dropping a UIScrollView on a UIViewController is a piece
of cake. Pinning the UIScrollView to the top and bottom layout guides -
left and right parent view edges, piece of cake. I can paint the background
bright green and see it just fine.

What is the best way to layout the 'content' views? I want them to be the
size of the UIScrollView's frame. Specifically, what is the best way to do
this using AutoLayout?

I know that Autolayout will cause the UIScrollView's contentSize to adjust
to fit its child views ... so does that mean I need to create height and
width constraints on the child views - ie: I need actual numerical values?

If so, I clearly don't want to hard-code 320.0 as the width ... so is it
appropriate to CGRectGetWidth(scrollView.frame) or
CGRectGetHeight(scrollView.frame) and rely on "frame" or "bounds" values of
the parent to setup the autolayout stuff in the children? Clearly this can
only be done after the scrollView has loaded and positioned itself.

It feels weird to mix the two abstractions and have to wait until the
scrollview is positioned before creating the constraints on the children -
feels dangerous/brittle. Feels like I'll have to manually handle device
rotations, etc ???

Thanks,
-Luther
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to