This is my code where I'm trying to create a subView... I'm using XCode4 with StoryBoards. The app is crashing on the 2nd line where it is allocating subView with EXC_BAD_ACCESS. vFrame has valid content. What is wrong with this? (I'm using XCode4 with Storyboards, btw).
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect vFrame = CGRectMake(60,100,200,200);
subView = [[UIView alloc] initWithFrame:vFrame];
subView.backgroundColor = [UIColor redColor];
[self.view addSubview: subView];
}
UPDATE: definition for subView:
@interface PreferencesViewController : UIViewController {
UIView *subView;
}
@property (nonatomic, retain) UIView *subView;
@end