• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UIScrollView contentSize question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UIScrollView contentSize question


  • Subject: Re: UIScrollView contentSize question
  • From: Kyle Sluder <email@hidden>
  • Date: Sat, 21 Jun 2014 22:10:53 -0700

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


  • Follow-Ups:
    • Re: UIScrollView contentSize question
      • From: Luther Baker <email@hidden>
References: 
 >UIScrollView contentSize question (From: Luther Baker <email@hidden>)

  • Prev by Date: UIScrollView contentSize question
  • Next by Date: Re: FSPathMakeRef deprecated - replacement for LSSetItemAttribute?
  • Previous by thread: UIScrollView contentSize question
  • Next by thread: Re: UIScrollView contentSize question
  • Index(es):
    • Date
    • Thread