Why UIButton does not require to alloc and init call instead we use only
UIButton *myBtn = [UIButton buttonWithType:UIButtonTypeCustom];.
- Does the above line automatically alloc s and init the uibutton??
- Is it necessary to release myBtn?,since i’m not using alloc and init explicitly.
This may be a simple question but i don’t know the correct answer for this, does anybody can help? Any help is appreciated,thanks in advance.
There’s a set of rules that the method names follow – read this link 😉
Basically, names beginning with
alloc,new,copyormutableCopyrequire you to callrelease(orautorelease).Any other methods that return an object will return autoreleased objects.
For example :
Hope that helps!