Re: Setting Up a MVC most of it works BUT
Re: Setting Up a MVC most of it works BUT
- Subject: Re: Setting Up a MVC most of it works BUT
- From: Graham Cox <email@hidden>
- Date: Fri, 10 May 2013 11:47:32 +1000
On 10/05/2013, at 10:35 AM, YT <email@hidden> wrote:
> BUT how does one send data from myDataModel to MyController.
> OR is that by request from MyController only?
It can be, but not exclusively. Sometimes your data model might want to "push" a value to the interface for display. It all depends on what it does.
> I tried to send MyController's ID during MyDataModel initialization.
> That works NSLOGs indicate MyDataModel receives MyController's ID.
>
> When I have MyController call a method in MyDataModel and attempt to call a method in MyController
> I get an error during compile "! No Visible @interface for NSObject ...."
>
> I have MyDataModel do the [super init] initialization.
> At the moment I'm baffled -
> Any advise would be appreciated.
-init is too soon. The interface is loaded after initialization, which is why it isn't available then. Instead, override the -awakeFromNib method and do the necessary stuff there. That is called after the interface is loaded, and is provided for this purpose. It is guaranteed to be called only once all of the interface is available.
--Graham
_______________________________________________
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