In a test program, I init 2 UITextFields, 2 UILabels, 1 UITextView and 1 UIButton programmatically in (void)loadview, and I try to release them immediately after [self.view addSubview:controlname] at the last of loadview. All of them work ok except UIButton. So when should I release button? And I wanna know what objects can be released immediately added to self.view?
Thanks a lot.
In a test program, I init 2 UITextFields, 2 UILabels, 1 UITextView and 1
Share
I’m assuming that you are creating the button with UIButton’s +(id)buttonWithType: and if that is the case, you shouldn’t release it.
I also would recommend using ARC so that you don’t have to worry about this at all.