Re: readonly IBOutlet autosynthesized property new warning
Re: readonly IBOutlet autosynthesized property new warning
- Subject: Re: readonly IBOutlet autosynthesized property new warning
- From: Joar Wingfors <email@hidden>
- Date: Wed, 30 Jan 2013 22:08:27 -0800
Hi Roland,
I haven't seen that issue before. That's a bit of a surprise to me.
In any case, you may not know that you don't have to have the property in the header if IB is the only one needing it. Your solution in this case may be to just remove the readonly declaration from the header.
Joar
On 30 jan 2013, at 02:34, Roland King <email@hidden> wrote:
> I've been using this pattern for some time now
>
> ClassName.h file
>
> @property( readonly ) IBOutlet UIView *someView; // declare readonly
>
> ClassName.m file
>
> // class extension
> @interface ClassName()
> @property( readwrite ) IBOutlet UIView *someView; // redeclare readwrite
> @end
>
> // no @synthesize statements since Xcode 4.3, not needed.
>
> So that the NIB set properties appear to users to be readonly, which I want them to be, but the class itself can set them in code as they are redefined readwrite in a class extension and the NIB loader would find the setSomeView: method and call it or fall back to the underlying _variable (as documented in Accessor Search Implementation Details). That's worked fine thus far.
>
> Now I get the following warning compiling the .m file
>
> "Readonly IBOutlet property when auto-synthesized may not work correctly with 'nib' loader"
>
> Why? What's it not potentially doing now which it was doing before, or potentially wasn't doing before and I was lucky? I find that if I use this pattern and get the warning, I can still put the following
>
> self.someView = someOtherView;
>
> in the body of the .m file and there's no compile warning there, and it works, so there appears to be a mutator auto-synthesized, which the NIB loader would also be able to use surely?
>
> I lastly find that being explicit with @synthesized removes the warning ..
>
> @synthesize someView = _someView;
>
> Why would that make a difference?
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden