I simply want to add a UIImageView to my view in a view-based application.
but the picture does not show up. only black screen and a window "GDB loading stack frames..." comes out.
Thank you for reading this post and help me with this problem.
dragon_tenvel , Sicga , thank you very much for the reply
I figured out the problem. I removed the empty method "loadView" and it works now. Maybe there is sth overrided by the empty method
Actually I don't know what's the difference between putting codes in loadView and viewDidLoad.
but I still have a question on when I can release sth allocated by [class-name alloc]. sometime the program terminated when I try to release something. should I push all the releases in the dealloc method?
From what I understand, anything you @synthesize in your implementation file (.m) you release in -(void)dealloc, I assume that is what you mean by [class.name alloc], anything you initialise in a function such as the viewDidLoad etc e.g NSMutableArray *array the contents of which are passed to the synthesized variable is normally released in that function, usually just before [super viewDidLoad];
Thank you! your comments really help me a lot to understand when to release. I found that in some sample codes from Apple there is no [super viewDidLoad] in the viewDidLoad method. It should be fine releasing instances at the end of the function where they were initialized.
Quote:
Originally Posted by Sicga
From what I understand, anything you @synthesize in your implementation file (.m) you release in -(void)dealloc, I assume that is what you mean by [class.name alloc], anything you initialise in a function such as the viewDidLoad etc e.g NSMutableArray *array the contents of which are passed to the synthesized variable is normally released in that function, usually just before [super viewDidLoad];