views:

25

answers:

1

Hi,

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 appDelegate 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

+1  A: 

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

jrtc27
that's what I have, but I am unable to connect the outlet. Will paste the code in my question ...
iFloh
correction: it should be `IBOutlet UITabBarController *tabBarController` in both sections. The `IBOutlet` specifies that it can be connected in Interface Builder, and makes no difference as far as I am aware to the reference/object/whatever the technical term is ;)jrtc27
jrtc27
me stupid ... thank you very much, correct :)
iFloh
no problem - glad I could help ;)
jrtc27