FROM : Corbin Dunn
DATE : Wed Nov 28 22:23:00 2007
On Nov 28, 2007, at 12:48 PM, David Hoerl wrote:
> I found a neat double knobbed slider on the web: http://developer.snowmintcs.com/controls/smdoubleslider/
>
> There is only a IB2 palette, so I figured I'd just add a NSSlider
> object to my NIB, change its class to SMDoubleClass, then do
> anything further in awakeFromNib.
>
> The problem is that the control ends up with a NSSliderCell and not
> a SMDoubleSliderCell - guess +cellClass does not get invoked for
> archived objects.
>
> At first, I could not subclass the cell as a nib2.x file does not
> support it. However, the IB3 docs say I can use the nib3.x file on
> Tiger (for building only, not editing). So, I changed formats,
> changed the cell class, and now all is working as expected.
>
> I was wondering though - suppose I had to stay with IB2 - how would
> I get the correct class of cell?
>
Do something like this (which you probably want to do anyways, if you
create an instance of SMDoubleClass in code):
+ (void)initialize
{
if (self == [SMDoubleClass class]) {
[self setCellClass:[SMDoubleSliderCell class]];
}
}
Also, I'd recommend a better classname: SMDoubleSlider is more
descriptive :)
corbin
DATE : Wed Nov 28 22:23:00 2007
On Nov 28, 2007, at 12:48 PM, David Hoerl wrote:
> I found a neat double knobbed slider on the web: http://developer.snowmintcs.com/controls/smdoubleslider/
>
> There is only a IB2 palette, so I figured I'd just add a NSSlider
> object to my NIB, change its class to SMDoubleClass, then do
> anything further in awakeFromNib.
>
> The problem is that the control ends up with a NSSliderCell and not
> a SMDoubleSliderCell - guess +cellClass does not get invoked for
> archived objects.
>
> At first, I could not subclass the cell as a nib2.x file does not
> support it. However, the IB3 docs say I can use the nib3.x file on
> Tiger (for building only, not editing). So, I changed formats,
> changed the cell class, and now all is working as expected.
>
> I was wondering though - suppose I had to stay with IB2 - how would
> I get the correct class of cell?
>
Do something like this (which you probably want to do anyways, if you
create an instance of SMDoubleClass in code):
+ (void)initialize
{
if (self == [SMDoubleClass class]) {
[self setCellClass:[SMDoubleSliderCell class]];
}
}
Also, I'd recommend a better classname: SMDoubleSlider is more
descriptive :)
corbin
| Related mails | Author | Date |
|---|---|---|
| David Hoerl | Nov 28, 21:48 | |
| Sean McBride | Nov 28, 22:21 | |
| Corbin Dunn | Nov 28, 22:23 |






Cocoa mail archive

