Matt Legend Gemmell Modesty is Lying

Mac OS X Cocoa and iPhone Development Services available at Instinctive Code.
Favorites icon
Favorites for iPhone
Speed-dial with style.
Mac OS X Cocoa and iPhone Developer for hire

Other Pages

Categories

Posted
28 October 2008 @ 4pm

Categories
Development, Source

Tags
, , , , ,

MGScopeBar

In need of some shiny new Cocoa source code? Then allow me to recommend MGScopeBar (which is actually from a project I started months ago, but I’m only just releasing it now so it’s new to you).

MGScopeBar provides a scope/filter bar like you’ll find in Mail, the Finder (in the Find/Spotlight window), iTunes and elsewhere. It requires Mac OS X 10.5 (Leopard) or later, and it looks like this:

It uses a delegate system very much like NSTableView’s data-source, and supports all kinds of snazzy things like optional icons for buttons, an accessory-view at the right side of the bar, button-groups which support single or multiple selection, and more. It also has a very cool feature which I call Smart Resize - take a look at the demo movie to see how it works.

You can get MGScopeBar from my Cocoa Source Code Subversion repository (see below if you don’t know how to do that), and you can find out more about it by reading the ReadMe file.

Lastly, if you’re feeling particularly grateful, may I be so bold as to mention the donation link on my Cocoa source code page and/or my rather nifty iPhone application, Favorites? Yes, I think I may.

How to get code from the Subversion repository

Just launch the Terminal application (it’s in /Applications/Utilities), paste the following command into the window (all on one line) and then press Return:

svn checkout http://svn.cocoasourcecode.com/MGScopeBar ~/Desktop/MGScopeBar

That command will checkout the latest copy of the source into a folder on your Desktop called “MGScopeBar”. The actual name of the folder is up to you, and you can then move that folder anywhere you like.

Whenever you want to update to the latest version of the code thereafter, launch the Terminal application again and use the commands below. Note that there are two commands, and that they should be pasted into Terminal one at a time, pressing Return after each. Also note that you should obviously change the first command to use the actual path to wherever you’re keeping the code.

cd ~/Desktop/MGScopeBar

svn update

If you want to find out more about Subversion, you can read the free online Subversion book.


9 Comments

Marc Charbonneau
28 October 2008 @ 5pm

Awesome. I created a class stub for a filter bar in an app I’m working on literally a few days ago, and hopefully this will work well enough that I can drop it right in instead of working on mine. The smart resize feature looks great, far better than what I had planned.

I was planning on modeling mine more after the “flat” look without recessed buttons, similar to the Genius bar in iTunes… any chance MGScopeBar could support that in a future version? Or is there are there any UI rules of thumb that that would violate?


Mike Rundle
28 October 2008 @ 6pm

Very nice! I don’t have a use for it right now but I’ll definitely be checking out the code to see how it all fits together.


Furies
28 October 2008 @ 7pm

Delicious is the only possible word to describe this wonderful bit of code =). I’m going to try to do some work on it and see if I can’t control it within PyObjC, should be able to.


Ronnie
29 October 2008 @ 2am

Cool!
It looks very amazing


Steven Degutis
11 November 2008 @ 2am

Looks to me like a perfect candidate for Leopard to include into Snow Leopard. Wouldn’t that be swell? Well, not really, since then we wouldn’t have the source. Quick, hide it before Apple finds out!


Matt
12 November 2008 @ 6am

How much of the code is Leopard only?

I want to use something like this, but I am developing for Tiger and Leopard. Would it be easy to change to work with both?


Matt Legend Gemmell
12 November 2008 @ 9am

Hi Matt,

I actually already have a patch here (submitted by a fellow developer) for MGScopeBar which will make it compatible with Tiger. I’ll integrate it and update the code in the subversion repository soon.


Matt
18 November 2008 @ 7am

Thanks for the info, Matt.

I will check back to see when it is updated.


Chris Patel
27 December 2008 @ 1am

1). I tried to use it, but it failed compiling at:
_firstCollapsedGroup = NSNotFound; in MGScopeBar.m, giving me overrun errors. I changed it to: _firstCollapsedGroup = nil; //NSNotFound; and it seems fine.
2) Also, the return type of delegate method is NOT int, and hence the compiler complains. I cast the return value to (MGScopeBarGroupSelectionMode), and now it works fine.

I actually tried to integrate it with my APPController, but it kept giving me error at scopeBar.delegate = self; in awakefromnib in MY AppController, saying MGScopeBar class is not found, using nil. I resorted to using your APPController, and its working fine. Now I have to somehow link it with my AppController.

Excellent piece of work. Love it and using it.

Chris

{


Leave a Comment

Favorites 1.0.1 submitted Favorites UI design