I am creating my first tab controller app. I have 2 tabs with 2 uiviews in them. I did this mostly from interface builder all I did in xcode was add 2 files firstControllerView and SecController view. I can see the tab controller is working went I run the app (I simply changed the background color on the 2 uiviews in the tabs to see the effect).
Now I want to add a label to the secondView and set its text programmically from code. This is whats breaking for me! I am doing something wrong. In my SecondViewController.h it looks like this:
@interface SecondViewController : UIViewController {
IBOutlet UILabel *title;
}
@property (nonatomic,retain) UILabel *title;
@end
..and the .m looks like this...
import "SecondViewController.h"
@implementation SecondViewController
@synthesize title;
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad {
[title setText:@"Hello Nick"];
[super viewDidLoad];
}
(void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use. }
(void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; }
(void)dealloc { [title release]; [super dealloc]; }
@end
After this I went back to interface builder and dragged the outlet reference to the label. When I run the simulator it crashes.
What am I missing here? it must be something simple, bare with me I am new