Re: UIScrollView contentSize question
Re: UIScrollView contentSize question
- Subject: Re: UIScrollView contentSize question
- From: Luther Baker <email@hidden>
- Date: Sun, 22 Jun 2014 19:50:28 -0500
I've got that working in code ... thoughts on how to do this with
storyboards? Or at least, I'd like to create the children views themselves
in the storyboard.
When I 'freeform' the view controller to allow me to show a UIScrollView
that is 2 "pages" wide, binding the first view to the width of the
scrollview (which is 720.0) and then pulling that view's display frame back
to half that (to place two children side by side) creates inconsistent
constraints wrt to the child view / scrollview widths.
( I followed a bit of what Rob talked about here
http://stackoverflow.com/questions/16889123/how-to-add-objects-to-a-uiscrollview-that-extend-beyond-uiview-from-storyboard/
and then watched a bit of his video here
https://www.youtube.com/watch?v=PgeNPRBrB18&feature=youtu.be )
On Sun, Jun 22, 2014 at 6:52 PM, Luther Baker <email@hidden> wrote:
> Yaay!
>
>
> On Sun, Jun 22, 2014 at 12:10 AM, Kyle Sluder <email@hidden> wrote:
>
>> On Jun 21, 2014, at 9:13 PM, Luther Baker <email@hidden> wrote:
>> >
>> > 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?
>>
>> Nope. You should be able to create an equal-width constraint between the
>> scroll view and one of your "page" subviews. Then make the rest of your
>> "page" subviews equal in width to the first one.
>>
>> You’ll also want to do this for the height.
>>
>> --Kyle Sluder
>>
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden