UIButton has a single initializer buttonWithType
. But this is a factory method and will create an autoreleased object. Of course we can do something like:
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(10, 10, 50, 30)];
But in this case i will not be able to set the button's type as buttonType
is a read only property.
So is there any way i can create buttons which are not autoreleased and still set their type?
P. S. :
Using AutoreleasePool with the autoreleased objects is a good practice. But i don't really have a problem with autoreleased objects. This is just a doubt.
I am not looking for solution for any particular scenario so please don't reply with questions like "Why do you want this?". It just occurred to me that this is something i am not able to do.. so i am asking..
Thanks, Swapnil