Re: Can I split an implementation file?
Re: Can I split an implementation file?
- Subject: Re: Can I split an implementation file?
- From: mmalcolm crawford <email@hidden>
- Date: Thu, 27 Nov 2008 11:05:35 -0800
On Nov 27, 2008, at 9:09 AM, Greg Robertson wrote:
Thanks for the link, one last question (I hope) if I declare foo as a
property and synthesize then I could use a category to override the
foo and setFoo. But I was wondering if I could just skip the
synthesize?
If your intent is to provide custom implementations of the accessors,
then use @dynamic in the main implementation block.
mmalc
MyClass.h
---------
@interface MyClass : NSObject {
NSString *title;
}
@property (nonatomic, copy) NSString *title;
@end
MyClass.m
---------
#import "MyClass.h"
@implementation MyClass
@dynamic title;
- (void)dealloc {
[title release];
[super dealloc];
}
@end
MyClass+Title.m
---------------
#import "MyClass.h"
@implementation MyClass (Title)
- (NSString *)title {
NSLog(@"Someone asked for my title");
return title;
}
- (void)setTitle:(NSString *)newTitle {
if (newTitle != title) {
[title release];
title = [[newTitle uppercaseString] retain];
}
}
@end
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden