Using Subclasses with Standard Classes
Using Subclasses with Standard Classes
- Subject: Using Subclasses with Standard Classes
- From: Seth Willits <email@hidden>
- Date: Sat, 9 Aug 2003 17:14:39 -0700
I'm having difficulty understanding how I would deal with this. I have
a NSTabViewItem subclass, CustomTab which I dynamically create and add
to a NSTabView. Later, I wish to retrieve the currently selected tab,
and use a method specific to the CustomTab class. This was working
until I changed the class using the code below from an NSTabView
subclass to an NSObject subclass.
The error in the run log is that NSTabViewItem doesn't implement the
selector "getMyObject", which of course it doesn't. How can I get get
the TabViewItem returned by [tabView selectedTabViewItem] to act like
the CustomTab object which it was originally created as?
- (MyObject *)currentObject
{
CustomTab * custTab = [tabView selectedTabViewItem];
return [custTab getMyObject];
}
- (CustomTab *)createNewTab
{
// Create new Tab
CustomTab * tab = [[CustomTab alloc] initWithIdentifier: @"My
Custom Tab"];
...
// Editing the tab
[tab setLabel:@"New Tab"];
[tab setView: theView];
// Add to the TabView
[tabView addTabViewItem:tab];
[tab release];
return tab;
}
Seth Willits
------------------------------------------------------------------------
---
President and Head Developer of Freak Software -
http://www.freaksw.com
Q&A Columnist for REALbasic Developer Magazine -
http://www.rbdeveloper.com
Webmaster for REALbasic Game Central -
http://www.freaksw.com/rbgames
"You may laugh at me for chasing a dream, but I'll have the last laugh
when I catch it."
-- Seth Willits
------------------------------------------------------------------------
---
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.