objective c - iPhone MVC app: Where should I put the model? -


I am very new to the development of the iPhone.

I am creating an app that has multiple views controllers There is only one model.

I need to share the model among all the controllers; So I have modeled the app within the App Delegate header file:

  @interface MyAppDelegate (... cutting ...) @ property (non-constructive, retaining) calcomold * model;  

and then synthesized accordingly.

Inside a controller, I have tried to refer to such models:

  CalcModel * model = [[[UIApplication shared application] representative] Model];  

The problem is that the compiler is not found in the '-model' protocol

That's because the representative field gives the type of protocol, not the solid MyAppDelegate type. .. then what should I put in [[UIApplication sharedApplication] representative] MyAppDelegate, so can I use model property? if so, how?

Or is this all wrong? In more detail, how do you view a model between controllers?

Many thanks for your help

Yes, just insert it I have a macro I define which makes it easy to wrap in a simple call.

Regarding a method of implementing the model structure, there are some useful hints in this article:

(We only consider ourselves single Apply the model in the form, and use KVO to listen for changes in properties.)


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -