|
|||||||
| Development XCode, Cocoa, and all other development |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
| 10-11-2006 | #1 (permalink) |
|
TAB Author
Join Date: Oct 2006
Posts: 3
![]() |
Apple did - so must you!
No, but seriously, only if you have an actual need for different scrollers. It's actually quite easy. Just a couple easy steps. 1) Create a new subclass of NSScroller. 2) Set the scroller of the view to be a new instance of this scroller 3) Decide which parts you want to draw different * I'll show just the knob, but the rest are easy as well 4) Reimplement the following: - (void)drawKnob; ...that's it! 5) Draw the knob ... here's just a solid color: - (void)drawKnob { [[NSColor redColor] set]; //set knob color to red NSRect knobRect = [self rectForPart:NSScrollerKnob]; NSRectFill(knobRect); } You now have a red, rectangular scroller!!! Using this method, you can customize every part of the scroller, including the arrows and highlighting. Go nuts! Michael p.s. Please read the documentation before doing this. If you want to draw anything other than the arrows or the knob, you'll need to draw all of the rest using - (void)drawParts. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
|
|