> On Oct 8, 2013, at 12:44 AM, Dave <d...@looktowindward.com> wrote:
> 
> Thanks Kyle,
> 
> That's what I was trying to figure out, whether I needed to re-layout the 
> views based on the positions or whether I could just do it by keeping an 
> Array of the image views separately and rotating this as it scroll past the 
> end. I sort of got this working, but of course the Subviews of the Scroll 
> View just grows and grows! 
> 
> This is what I got at the moment:
> 
> //  Scroll past last item detected (in the scrollViewDidScroll delegate 
> method)
> 
>    if (theScrollView.contentSize.width - theScrollView.contentOffset.x <= 
> 1024)
>        {
>        myContentInfo = [self.pContentArray objectAtIndex:0];
>        [self.pContentArray addObject:myContentInfo];
>        [self.pContentArray removeObjectAtIndex:0];
>        
>        [self addContentInfo:myContentInfo withEndFlag:YES];
>        }
> 
> Which kind of works, but obviously isn't the way to do it. 
> 
> Thanks for confirming I needed to use -layoutSubviews, I'm about to start on 
> this track now.

You don’t *have* to use -layoutSubviews, but you'll probably get the best 
results if you do. You could theoretically do this all in the delegate's 
implementation of -scrollViewDidScroll:, but that’ll probably double the number 
of layout passes and certainly multiply the number of message sends. When 
scrolling, you want to avoid as much unnecessary work as is reasonable.

It’s kind of a bummer that you’re going to need to split your logic up between 
the scroll view and its delegate, thus tightly coupling the two. I wish the 
frameworks exposed many more of their delegate hooks as subclass hooks as well. 
Scroll views seem to stir this desire particularly frequently.

--Kyle Sluder

_______________________________________________

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