I have a button that pushes another viewcontroller onto my navigationcontroller. When I press the button, I will get EXC_BAD_ACCESS on the line where I add the subview statusLabel.
When I remove that line. I can compile and run, I can also go to my other view.
- (void)loadView
{
statusLabel = [[[UILabel alloc] initWithFrame:CGRectMake(20.0, 0.0, 150.0, 43.0)] autorelease];
[self.view addSubview:statusLabel];
}
Thanks
loadViewmethod is used for custom view loading (i.e. creatingself.viewand adding all of its subviews). If you have your controller’s view in a nib you should place this code intoviewDidLoadmethod.