Translate

> > Load a View with UINavigationController

Load a View with UINavigationController

Posted on Friday, April 8, 2011 | No Comments

In App Delegate Header File Add

UINavigationController *uinav;
and a
UIViewController which will you create

Then AppDeligate Implementaion File add

this function will be automatic create in view based application
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
    // Override point for customization after application launch.
This is the line which will need for load a view under navigation controller
uinav = [[UINavigationController alloc]initWithRootViewController:viewController];
    // Add the view controller's view to the window and display.
    [window addSubview:uinav.view];
    [window makeKeyAndVisible];

    return YES;
}



-------------------------------------------------------------------------------------------------------------------
if u want to change UINavigationController default color then add following line in your appDeligate Implementation file.



@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"image_nav.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end

Leave a Reply

Powered by Blogger.