Better that you don't use the application delegate to set up your view, just load your first root view. So change the appDelegate's applicationDidFinishLaunching: back to
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
[window addSubview:viewController.view];
[window makeKeyAndVisible];
}
And go into your view that it calls and punch in this code, that'll create your UIButton for you. I've also added the change of the background color to make sure you're loading this view.
- (void)loadView {
self.view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];
self.view.backgroundColor = [UIColor redColor];
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 20, 100, 20)];
[button setTitle:@"UIButton!" forState:UIControlStateNormal];
[button setReversesTitleShadowWhenHighlighted:YES];
[button setShowsTouchWhenHighlighted:YES];
[self.view addSubview:button];
[button release];
}
Usually I'd prefer to programatically build my views since I can override drawRect: which you can't do inside InterfaceBuilder afaik.