AppDelegate viewController memory leak?

Posted by fuzzygoat on Stack Overflow See other posts from Stack Overflow or by fuzzygoat
Published on 2010-06-10T15:34:59Z Indexed on 2010/06/10 15:53 UTC
Read the original article Hit count: 343

Filed under:
|
|

I am just curious with regards to the correct way to create a view controller programatically. When I compile this code with the static analyser I get a leak (as you would expect) from the alloc. Should I just leave it as it needs to stay until the app exits anyways, or is there a cleaner way?

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

    NSLog(@"UIApplication application:");
    RectViewController *myController = [[RectViewController alloc] init];
    [window addSubview:[myController view]];
    [window makeKeyAndVisible];
    return YES;
}

cheers Gary

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c