Re: Infinite Scroll View?
Re: Infinite Scroll View?
- Subject: Re: Infinite Scroll View?
- From: Dave <email@hidden>
- Date: Wed, 09 Oct 2013 14:36:33 +0100
Hi,
Got it working! The problem was partly due to tiredness and partly due to a misunderstanding about when layoutSubviews gets called.
If you look at the Street Scroller sample, you'll see that it has its content "in-built", in fact it generate new content on the fly. The problem I had was that the content (images in this case) needed to be loaded externally from a URL or from a file. Once I figured out how to get the process going it was ok and I did it without having to add code to the delegate which is always a good thing.
Thanks a lot to everyone that helped.
All the Best
Dave
On 9 Oct 2013, at 00:07, Damian Carrillo <email@hidden> wrote:
> Hi Dave,
>
> What about if you have some repetition of the images? Say the following is a container UIView that has all of your UIImageViews stacked horizontally and the width of the following view is far smaller than that of the UIScrollView it's contained in. The gray areas are duplicated image views, and the the white area is the "true" set of images.
> <scroll.png>
>
> Say that in the previous image, the leftmost person is the first logical image in your set of data. In your viewDidLoad, you could set the contentOffset to the position of the first Person (ie. the leftmost white edge) with something like:
>
> - (void)viewDidLoad
> {
> CGFloat someXPos = CGRectGetWidth([pictures frame]) + CGRectGetWidth([reticle frame]);
> [scrollView setContentOffset:someXPos];
> }
>
> Then, once the user breaches the threshold value that has duplicates (the gray areas), you call the following:
>
> - (void)scrollViewDidScroll:(UIScrollView *)scrollView
> {
> [scrollView setContentOffset:someXPos animated:NO];
> }
>
> The intent is that the scroll view snaps the container UIView back to a position that contains no duplicates. The view has duplicates to account for the period of time between sampling of scroll events. Note that this suggestion is assuming that the images are fairly small, so that loading them all doesn't cause too much memory pressure (which is what I understood from earlier messages).
>
> Damian
>
> On Oct 8, 2013, at 4:53 PM, Dave <email@hidden> wrote:
>
>> Hi,
>>
>> Yes, I took a look, but it's not what I want to do. I have a number of variable width images, not fixed width and all the examples I've seen use pagingEnabled and have a fixed width.
>>
>> Also the Street Scroller sample, just creates a label view on demand, which, again isn't what I want. I have (say) 20 variable width images, so I want it to scroll from image 1 to 20 and then back to 1. The samples doesn't do anything like this.
>>
>> Thanks anyway,
>> All the Best
>> Dave
>
_______________________________________________
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