HI Nick, In my app, I have two IKImageBrowserView subclasses (thumbnailsBrowser) that I populate with the pictures I need. It supports scrolling out of the box with the mouse or trackpad when needed. For one of my subclass, I resize the popover because it can only have up to 5 pictures in it, so I in fact disable scrolling. The other one however, can have up to 50 images, so to also allow scrolling with clicking a button, I wired two NSButton to this method:
- (IBAction)coverBrowserGo:(id)sender { NSIndexSet *currentlyVisible = [thumbnailsBrowser visibleItemIndexes]; if(debugging) NSLog(@"current IndexSet: %@", currentlyVisible); if ([sender tag] == 0) //Go Left { // Are we already showing the first item? if ([currentlyVisible firstIndex]==0) return; [thumbnailsBrowser scrollIndexToVisible:[currentlyVisible firstIndex] -1]; } else //Go Right { if(debugging) { NSLog(@"resultMatchArray: %lu", [resultMatchArray count]); NSLog(@"lastIndex: %lu", [currentlyVisible lastIndex]); } // Are we already showing the last item? if ([currentlyVisible lastIndex]+1==[resultMatchArray count]) return; [thumbnailsBrowser scrollIndexToVisible:[currentlyVisible lastIndex] +1]; } } To support clicking on an image, I have two choices. In one case I add the IKImageBrowserController delegate method, where I can then get the index of the currently selected index for aBrowser: - (void) imageBrowserSelectionDidChange:(IKImageBrowserView *)aBrowser; In the other case, I subclass the mouseUp method in my IKImageBrowserView subclass, then pass data back to the delegate: - (void) mouseUp:(NSEvent*)inEvent { id delegate = self.delegate; if (delegate) { NSPoint mouse = [self convertPoint:[inEvent locationInWindow] fromView:nil]; NSInteger objectIndex = [self indexOfItemAtPoint: mouse]; if (objectIndex == NSNotFound) [delegate toggleCoverFloatingWindow:nil]; else [delegate displayCoverFloatingWindow: objectIndex]; } [super mouseUp:inEvent]; } Hope that helps, Olivier./. Molowa. On Dec 21, 2011, at 10:22 AM, Nick wrote: > I am not sure how to do this. > Currently, I have an NSScrollView (whose document view has all the > item views), with hidden scroll bars, and buttons "next" and > "previous". When "next" and "prev" are clicked, I -scrollToPoint > NSScrollView's content view a bit to the right or to the left. > It seems to be working as I need, except that it doesn't scroll > smoothly (I guess I need to use somehow). I suppose I need to attach a > core animation layer to NSScrollView? Or use somehow CAScrollView? > I've never worked with Core Animation before, except using animator > "proxy", however > [[[[myscrollview] contentView] animator] scrollToPoint:nextPoint]; > doesn't add any animation.. > What would be the quickest way to make it work? > > 2011/12/21 Vincent Habchi <vi...@macports.org>: >>> And then, I do not have much space on the window to put this >>> coverflow (while a strip can be small and still look good), plus a >>> strip can display more than 1 item at once, and the user can click on >>> any of these items without too much of scrolling). >> >> Why don’t you use CALayers (more specifically a CATileLayer and sublayers >> containing your images)? >> >> Vincent > _______________________________________________ > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/olivier%40sunprotectingfactory.com > > This email sent to oliv...@sunprotectingfactory.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com