Can't restore appDelegate window outlet in IB
I accidentally deleted my appDelegate window outlet and don't manage to resore it again.
My window based App has a TabBarController.
I am using xCode 3.1.3. See belows link to a screenshot of IB with appD开发者_如何学Celegate outlets.
http://www.rodiun.com/innflohmation/x23/IB-appDelegate.jpg
any hint is most appreciated,
my appDelegate code looks like this:
#import <UIKit/UIKit.h>
@interface LGS2010AppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
UIWindow *window;
UITabBarController *tabBarController;
}
@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) UITabBarController *tabBarController;
and the implementation:
@implementation LGS2010AppDelegate
@synthesize window, tabBarController;
#pragma mark -
#pragma mark setup methods
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Add the tab bar controller's current view as a subview of the window
[window addSubview:tabBarController.view];
}
iFloh
You need to add UITabBarController *tabBarController;
to the @interface
section, and make it a nonatomic
and retain
property. Then connect the outlet, and make sure that in the applicationDidFinishLaunchingWithOptions
you call [window addSubview:tabBarController];
.
精彩评论