I have seen 2 ways to create button.
UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(10, 220, 150, 30)];
and
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
The first case is the normal way to create a button object. I have allocated and initialised a button instance and I have to release that. I am really confused about the second way. I have some questions regarding this.
- Is a button instance created in this case?
- What is the retain count of this button?
- Should I release this button?
Hope this helps: