开发者

how to load another nib file?

how to load another n开发者_如何学Cib file from viewbased application.

I added button in root nib file.... on clicking button i need to load another nib file.


In app delegate use this

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

    // Override point for customization after application launch.
    // Add the view controller's view to the window and display.
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
    [window addSubview:navigationController.view];
    [window makeKeyAndVisible];

    return YES;
}

and

In controller class use:

    -(IBAction)buttonClick:(id)sender{

 SecondViewController *_secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
        [self.navigationController pushViewController:_secondView animated:YES];

    }

It will works fine..... enjoy

Thanks people.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜