Tutorial :Where to correctly declare and release Objects in Objective C



Question:

I would like to know from people with experience where the best place to declare, initialize and release objects is.

Should all objects including NSStrings always be declared in the header file?

Are variables like an int declared in the header file?

If I declare an object or use an object in a method, should it be released in that method or in the dealloc method?

If an object is only needed in the method, should it just be declared and released within the method?

This is simple, but the header and implementation file style is new to me.

Regards


Solution:1

It depends entirely on what you are trying to do. The documentation does a good job of covering much of what you are asking.

I would suggest reading the Objective-C conceptual guide and then rephrasing your questions to something more specific.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »