Kundan Pandit
Kundan Pandit

Reputation: 412

How to switch one view with one UIButton on it,to the one with navigation controller using thatUIButton?

i am making an application with login view. This is just simple UIViewController with one UIbutton on it.I have another UINavigatioController having UITableView as RootViewContoller with many table objects at each row.The problem is : how to switch from loginview to tableview.Also there should be no navigationcontroller on loginview..and if it is not possible then there should be a way to hide it on loginview. For loginview i have login.xib which i load it during application startup.but after clicking UIButton on loginview it should go to TableViewController having NavigationController.Is it possible to load TableviewController with NavigationController from seperate nib.if it is then how would i set delegates and view outlets on that nib.?.. I m restless to get its reply..its my request 2 all progrmmers to get a look over it..though it seems bit easy but isn't..i m hanging it with more than 2 weeks..plz help this poor-guy!

Upvotes: 0

Views: 627

Answers (2)

user302326
user302326

Reputation:

-(IBAction)goToView2:(id)sender 
{
MyTableViewController *tableView = [[MyTableViewController alloc] initWithNibName:@"MyTableViewController" bundle:nil];
UINavigationController *mySocondView =[[UINavigationController alloc]
                                initWithRootViewController:tableView];
[self presentModalViewController: mySocondView animated:YES];
}

Upvotes: 1

Mc.Lover
Mc.Lover

Reputation: 4994

first u should set delegate to ur Navigation Controller . if you know how can set delegate . use this code to go to another view with UITableView and navigation controller :

-(IBAction)goToView2:(id)sender 
{

    UINavigationController *mySocondView =[[UINavigationController alloc]
                                    initWithRootViewController:[[MyTableViewController alloc]
                                                                initWithNibName:@"MyTableViewController" bundle:nil]];

    [self presentModalViewController: mySocondView animated:YES];
}

on your navigation view u can continue your project :)

Upvotes: 1

Related Questions