Reputation: 22939
Let's assume I have the following class GenericMoviePlayer
which has the following Outlets:
Those IBOutlet
s have their corresponding IBActions
:
- (void) playTouched:(id)sender;
- (void) pauseTouched:(id)sender;
- (void) doneTouched:(id)sender;
When those buttons are touched a delegate of my class is informed.
Now this is all well but imagine I now want a special type of player which should inherit from this more generic player. I will now have new Outlets, new Actions and new methods in the delegate protocol. So how can I achieve this?
Subclassing and IBOutlets go well together but I don't know how I have to design my subclass that I can "inherit" the IBActions and kind-of overwrite the delegate protocol too.
Upvotes: 1
Views: 964
Reputation: 4955
Since the IBAction
s are defined in your GenericMoviePlayer
header, those methods will be available to you in your SpecificMoviePlayer
xib. So when you go to connect those buttons in your xib, those GenericMoviePlayer
IBAction
s will be available to you. Technically, if your SpecificMoviePlayer
needs to add functionality to your play/pause/done methods (or change that functionality completely) you an override those methods.
This is kind of a high level overview, but if you have specific examples of what you want to accomplish, I'd be happy to help you out. I think your question needs a bit more clarification on exactly what you're hoping to accomplish (other than the reuse of code).
Upvotes: 1