Re: UICollectionView parallax-like horizontal scrolling
Re: UICollectionView parallax-like horizontal scrolling
- Subject: Re: UICollectionView parallax-like horizontal scrolling
- From: "Mazzaroth M." <email@hidden>
- Date: Thu, 16 Oct 2014 18:34:59 -0400
Thanks, will investigate your suggestions.
On Thu, Oct 16, 2014 at 10:54 AM, Luke Hiesterman <email@hidden>
wrote:
> There are multiple ways to skin this cat. One is to use two collection
> views and just modify the content offset of one of them in response to the
> scrolling of the other.
>
> The behavior can also be built into a layout if you want to use a single
> scroll view. You don’t need different types of cells - you just need your
> layout to make a choice about how it wants each index path to behave. As an
> example, I might create a two column layout where all the even numbered
> indexes are on the left and all the odd numbered indexes are on the right.
> Or maybe it would be something different than that - maybe the first
> section would go on the left and the second section would go on the right.
> Could be anything. Then if I decided I want the right column to scroll
> faster than normal to create the parallax effect, I would return YES from
> -shouldInvalidateLayoutForBoundsChange: and then modify the positions of
> the layout attributes for all the items in the right hand column based on
> some math relative to the content offset. This would accomplish updating
> the frames of the right hand column cells every frame that a scroll occurs
> and achieve the parallax effect.
>
> Luke
>
> > On Oct 15, 2014, at 10:01 PM, Mazzaroth M. <email@hidden>
> wrote:
> >
> > In the running apps view(double-tap Home button) there are two rows each
> > which contain two different types of cells. How would one implement this
> > using UICollectionView?
> >
> > I more or less want to do this where the lower row cells are slightly
> > narrower than the upper row such that when you swipe to scroll, the items
> > in both rows are centred on the screen at the same time but because the
> > items in row 1 are slightly narrower, they will scroll slightly faster
> than
> > the items in row 0 creating a parallax-like effect. An extreme example of
> > this would be
> >
> > https://github.com/allaboutapps/A3ParallaxScrollView
> >
> > in the tree example, however this is done with a custom UIScrollView
> > subclass.
> >
> > And so, I know that this is possible but not sure if I can do it with
> > UICollectionView and may need to use UIScrollView instead(however would
> > prefer to figure it out with UICollectionView).
> >
> > In my attempts for UICollectionView, I was thinking that I'd need to use
> > one type of cell for row 0 and another type of cell for row 1, but it's
> not
> > clear to me how to specify a different layout for each of the rows, which
> > appears to be what I need to do.
> >
> > Any thoughts on this?
> >
> > maz
> > _______________________________________________
> >
> > 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
>
>
_______________________________________________
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