• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Carousel - like control for Mac OS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Carousel - like control for Mac OS


  • Subject: Re: Carousel - like control for Mac OS
  • From: Olivier Palliere <email@hidden>
  • Date: Wed, 21 Dec 2011 11:15:39 +0100

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 <email@hidden>:
>>> 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 (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

_______________________________________________

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

References: 
 >Carousel - like control for Mac OS (From: Nick <email@hidden>)
 >Re: Carousel - like control for Mac OS (From: "Stephen J. Butler" <email@hidden>)
 >Re: Carousel - like control for Mac OS (From: Nick <email@hidden>)
 >Re: Carousel - like control for Mac OS (From: Vincent Habchi <email@hidden>)
 >Re: Carousel - like control for Mac OS (From: Nick <email@hidden>)

  • Prev by Date: Re: Example code eyePhoto-Step8 & IB help needed
  • Next by Date: Re: Lion: Batch close
  • Previous by thread: Re: Carousel - like control for Mac OS
  • Next by thread: Re: Carousel - like control for Mac OS
  • Index(es):
    • Date
    • Thread