0

how to load another nib file from viewbased application.

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

Cristian
  • 198,401
  • 62
  • 356
  • 264
kiran kumar
  • 1,349
  • 4
  • 21
  • 40
  • @ ranjeet sajwan ...can you give tell me detailed way... Thanks in advance – kiran kumar Nov 01 '10 at 07:21
  • i add new class UIViewController Subclass...called abcd..... new i created abcd nib for that uiviewcontroller..... I added a new button when button click my abcd nib file need to load : I created project of ViewBased Application – kiran kumar Nov 01 '10 at 08:49
  • ControllerMusic *music = [[ControllerMusic alloc] initWithNibName:@"BusinessUser" bundle:nil]; [self.view addSubview:music.view]; [music release]; I used this in -(IBAction)PlaylistButtonPressed:(id)sender – kiran kumar Nov 01 '10 at 09:19

1 Answers1

0

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.

kiran kumar
  • 1,349
  • 4
  • 21
  • 40