Does (scrollView.contentOffset.x <= 0) not work? How are you testing for it now?
On Oct 8, 2013, at 12:20 PM, Dave <d...@looktowindward.com> wrote: > Hi, > > I finally managed to get back on this! I've got it working when scrolling > from left to right and can detect when the user scrolls past the last item, > however, I can't seem to find a way to detect when the user scrolls to before > the first item. > > I get -0 for offset X > > 2013-10-08 20:18:20.607 LTWScrollTest1[17988:a0b] contentOffset : {-0, 0} > > But that doesn't do me much good! > > It seems to work quite nicely going left to right, but having difficulties > figuring out how to make it work scrolling right to left. > > > Any idea greatly appreciated as I'm need to get this working for tomorrow > morning! > > Thanks a lot. > > All the Best > Dave > > > > On 8 Oct 2013, at 08:56, Kyle Sluder <k...@ksluder.com> wrote: > >>> 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/punster%40mac.com > > This email sent to puns...@mac.com _______________________________________________ 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