Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

-Alloc [[]Init] vs. New

I'm not sure I'm getting this correctly, but is there a difference between a initializing a receiver with alloc/Init vs. using +(id)new


Where does the class name argument fit into the +(id)new method?


In either case, once a new instance is returned, does that mean that during runtime the instance of the object will be where the command pointer goes next? And then that instance continues to be available during run until deallocated?


What if you want to have more than one instance of the class available during runtime? Is it better just to initialize one, use it, destroy it, and initialize another, etc, in rapid succession, or better to initialize a quantity of instances, if needed during runtime (if possible)?

iMac

Posted on Jun 18, 2012 8:32 AM

Reply
Question marked as Best reply

Posted on Jun 18, 2012 8:35 AM

Create as many instances of a class that you need at the time you need them.


Depends entirely on your requirements.

49 replies

-Alloc [[]Init] vs. New

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.