| Index | Submit class | Submit snippet | Submission feed | List |

PWPolishedSlider

Language: Objective-C, Author: Collin Henderson
License: Public domain

This is a volume slider that looks like the slider from iTunes. Does not support ticked sliding.

PWPolishedSlider source preview

#import "PWPolishedSlider.h"
#import "PWPolishedSliderCell.h"

@implementation PWPolishedSlider

+ (Class)cellClass
{
  return [PWPolishedSliderCell class];
}

- initWithCoder: (NSCoder *)origCoder
{
  if(![origCoder isKindOfClass: [NSKeyedUnarchiver class]]){
    self = [super initWithCoder: origCoder]; 
  } else {
    NSKeyedUnarchiver *coder = (id)origCoder;
    
    NSString *oldClassName = [[[self superclass] cellClass] className];
    Class oldClass = [coder classForClassName: oldClassName];
    if(!oldClass)
      oldClass = [[super superclass] cellClass];
    [coder setClass: [[self class] cellClass] forClassName: oldClassName];
    self = [super initWithCoder: coder];
    [coder setClass: oldClass forClassName: oldClassName];
  }
  
  return self;
}

@end

PWPolishedSlider header preview

/* PWPolishedSlider */

#import <Cocoa/Cocoa.h>

@interface PWPolishedSlider : NSSlider
{
}
@end
Download Archive

Compatible with:


Comments

Michele Balistreri says:

I need to rename this because it does not have a prefix. It'd be great if you could give me one.

Collin Henderson says:

Why do you have to rename it? All you do is is add the four files plus graphics in to your project, and then when you make an NSSlider just go to custom class -> PolishedSlider

Michele Balistreri says:

Because someone else may want to upload its own PolishedSlider (maybe even based on yours). Being in a flat namespace, there is the convention to prepend a 2 or more letters prefix to the name of each class to avoid collisions. Even Apple follows this prepending NS (for NextStep) to its own classes. Technically there is no reason for this, is just matter of being a good citizen.

Collin Henderson says:

Ah I thought you meant like a prefix file:P
Sorry about that, is there a way to just update the one i have uploaded or do I have to add a totally new file?

Collin Henderson says:

IF you have to do it yourself make the prefix PW (for PolishedWindow)

Michele Balistreri says:

Unfortunately editing interface is not ready yet, I will do it manually without problems.

Collin Henderson says:

Thanks so much, sorry for the trouble!

Sean Patrick O'Brien says:

Does this code happen to come from the iLifeControls framework?

Collin says:

It's based on it, yes, should have given you credit - I'll try and fix that - my apologies

Sean Patrick O'Brien says:

No worries; I'm actually trying to get my hands out of the iLifeControls framework. It hasn't been updated in ages, and I have no plans for furthering it. I'll probably end up making it public domain, perhaps on Google Code.

Name

Website

Do you hate spammers? (Answer "Yes")