I am learning how to create apps with multiple views using the Window-based application template. I am trying to implement a tab bar but when my view loads, it is a blank. I realize it could be an issue between versions of iPhone SDK or Xcode. I am using the latest version of both (iOS 4.3 and Xcode 4.0).
My current code is as follows:
.h file:
@interface iBountyHunterAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UITabBarController *tabcontroller;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabcontroller;
.m file:
@synthesize window;
@synthesize tabcontroller;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
[window addSubview:tabcontroller.view];
[window makeKeyAndVisible];
}
In the sample code I downloaded, this worked fine. I can’t figure out where the problem is and any suggestions would be greatly appreciated.
So I think I figured it out. Due to the lack of the
UIWindow *windowin the ApplicationDelegate.h@interface:I had to reference
[self.window addSubview:tabcontroller.view];in myapplication didFinishLaunchingmethod,rather than just
[window addSubview:tabcontroller.view];Thanks for the assistance.