开发者

Can't restore appDelegate window outlet in IB

开发者 https://www.devze.com 2023-01-04 13:20 出处:网络
I accidentally deleted my appDelegate window outlet and don\'t manage to resore it again. My window based App has a TabBarController.

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];.

0

精彩评论

暂无评论...
验证码 换一张
取 消