Objective C: Initialization of Objects -


if wanted create uiimage example, difference in following 2 lines of code:

uiimage *img = [uiimage imagewithcgimage:cgimage];  uiimage *img = [[uiimage alloc] initwithcgimage:cgimage]; 

is case of "same end, different means"?

imagewithcgimage: returns autoreleased instance while initwithcgimage: returns image must release yourself. typically can count on class method return autoreleased object while instance init method returns object must release.

if using arc code, same thing, see related question more information: with arc, what's better: alloc or autorelease initializers?


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -