Regarding MVC design pattern
Regarding MVC design pattern
- Subject: Regarding MVC design pattern
- From: Sai <email@hidden>
- Date: Sun, 16 May 2010 01:56:15 +0800
Hi All,
I am new to cocoa development. Suppose I have an iPhone application follow
the MVC design pattern.
The Model is presented by an custom object. And I have declared an instance
of the Model Object as a IBOutlet
in my Controller class. I found that every time I start my application, this
instance of Model Object will be initialized.
My first question is who called this init method, what for?
As I found that it will be initialized automatically, so I just send message
for that instance, and crashed at runtime
with a exc_bad_access signal error. So I have to call alloc and init for
that Model Object and assign the returned
instance to the IBOutlet variable, then everything runs well.
My second question is if I have to allocate and initialized that Model
Object for myself? Is it over-done for this
initialization because it is called automatically before.
My third question is where I should call the release method for this
instance of Model Object?
Sorry that my English may not be good enough to make things clear. Hope you
guys can understand my situation.
Thanks a lot for your help and time in advance.
best regards,
ico
_______________________________________________
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