• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can I split an implementation file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Can I split an implementation file? (From: "Greg Robertson" <email@hidden>)
 >Re: Can I split an implementation file? (From: Matt Gough <email@hidden>)
 >Re: Can I split an implementation file? (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Can I split an implementation file? (From: "Greg Robertson" <email@hidden>)

  • Prev by Date: Re: Can I split an implementation file?
  • Next by Date: cString
  • Previous by thread: Re: Can I split an implementation file?
  • Next by thread: Re: Can I split an implementation file?
  • Index(es):
    • Date
    • Thread