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 <damiancarri...@me.com> 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 <d...@looktowindward.com> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to