Re: Infinite Scroll View?
Re: Infinite Scroll View?
- Subject: Re: Infinite Scroll View?
- From: Kyle Sluder <email@hidden>
- Date: Mon, 07 Oct 2013 11:54:31 -0700
On Mon, Oct 7, 2013, at 09:21 AM, Dave wrote:
> Hi,
>
> I'd like to be able to Scroll Infinitely in a Scroll, e.g. when the
> scrolling is past the last item in the Scroll start displaying the first
> and when scrolling before the first item, starting displaying the last.
> The items in this case are UIImageViews and they have a fixed height and
> a variable width and no one image will be wider that the Scroll View
> itself. Also it needs to work with pagingEnables = NO, e.g. there will be
> more than one Image visible.
>
> I've playing around a bit and found a some sample code that sort of does
> it but it doesn't handle the wrapping the Images smoothly (is was written
> to have paging enabled).
>
> My plan was/is to detect when the scrolling had hit before the
> first/after the last and to move the first Subview to the End or the Last
> one to the beginning, depending on the direction of movement, but at the
> moment, I can't seem to see a way of detecting these conditions.
It seems fairly straightforward, if a little labor intensive, to figure
out the width and placement of all your image views, override
-layoutSubviews to position only the ones that are potentially visible,
and implement
-scrollViewWillEndDragging:withVelocity:targetContentOffset: to figure
out where to end scrolling, based on the current velocity.
--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