1

I have custom view controller named DRTableViewController

In my app delegate, I use the following function to load

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.

    tvc = [[DRTableViewController alloc] init]; // tvc is created with xib


    navCon = [[UINavigationController alloc] initWithRootViewController:tvc];

    [self.window addSubview:[navCon view]]; 

    [navCon release];

    [self.window makeKeyAndVisible];

    return YES;
}

but when I start my application, navigation controller appears but the view inside it is black,

when I use

[self.window addSubview:[tvc view]];

instead of [navCon view]; I can see my view without any problem

Thanks in advance

Mutix
  • 4,196
  • 1
  • 27
  • 39

1 Answers1

0

You need to retain your navigation controller so it is not released.

Create a property for you navigation controller and retain it in the application delegate.

A quick fix is to comment out the line,

[navCon release]

But this will introduce a memory leak.

railwayparade
  • 5,154
  • 1
  • 39
  • 49