I never retain IBOutlet properties. The view retains the object when it is added, so also retaining the property would increase the retain count to 2. I have not encountered a condition where I was required to access an IBOutlet property after the view had been unloaded, so this approach has worked well for me. My foggy memory tells me this is (or was) best practice, but I'm just too lazy to look it up right now. YMMV.
Regards, -jwd // Joseph W. Dixon On Fri, Apr 5, 2013 at 9:18 AM, Tom Davie <tom.da...@gmail.com> wrote: > 1) yes you could use the code you outlined to access the property > 2) @property (assign, nonatomic) IBOutlet NSWindow *iWindow; > > Note though to be careful about the assign tag there – you may well want > that to be a retain. > > Thanks > > Tom Davie > > On 5 Apr 2013, at 15:06, Pax <45rpmli...@googlemail.com> wrote: > > > …And how would I make '@property (assign, nonatomic) NSWindow* iWindow;' > an IBOutlet so that I can hook it up to my window in interface builder? > > > > On 5 Apr 2013, at 15:00, Tom Davie <tom.da...@gmail.com> wrote: > > > >> The reason it's a bad idea is because it means that you have two > strongly coupled components of code. You can not change the implementation > of the class with the ivar, without also changing the implementation of the > other class now. > >> > >> I don't really understand your argument about lines of code or > readability, you would be replacing > >> > >> someObject->someIvar = 56.9f; > >> > >> with > >> > >> someObject.someProperty = 56.9f; > >> > >> and > >> > >> { > >> float someIvar; > >> } > >> > >> with > >> > >> @property (assign, nonatomic) float someProperty; > >> > >> So neither is really true. > >> > >> Thanks > >> > >> Tom Davie > > > > _______________________________________________ > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/spam%40dixondata.com > > This email sent to s...@dixondata.com > _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com