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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to