0

I'm now checking in my app if a xml file contains more than 1 file if not i would like to push the viewcontroller automatically to an other viewcontroller.

i'm now doing this and it works BUT!

UIViewController *rootController = [[ViewControllerOne alloc] initWithNibName:@"ViewControllerOne" bundle:nil];

navigationController = [[UINavigationController alloc] initWithRootViewController:rootController];

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];

i need to send data from the first viewcontroller to the one i'm pushing to (ViewControllerOne) normally to do this i'm doing:

ViewControllerthree *Controller = [[ViewControllerthree alloc] initWithNibName:@"ViewControllerthree" bundle:[NSBundle mainBundle]];

Controller.Title = [item objectForKey:@"Title"];
[self.navigationController pushViewController:Controller animated:YES];
Controller = nil;

I want to combinate this code so i can 'redirect' the controller if it contains two things in the ViewController, it needs to push it without a backbutton showing up in the viewcontroller i'm pushing data to

Gavin
  • 8,039
  • 3
  • 28
  • 40
Jones
  • 365
  • 7
  • 23
  • 2
    I don't understand your question. The code you posted doesn't seem to relate to your question? – onnoweb May 11 '12 at 20:49
  • do u want to skip view controllers when dismissing? lets say from C u return to a by by-passing B? if so, see this: http://stackoverflow.com/questions/2944191/iphone-dismiss-multiple-viewcontrollers – vikingosegundo May 11 '12 at 21:03

2 Answers2

2

LOL thats the answer! You just posted the answer try this;

ViewControllerthree *Controller = [[ViewControllerthree alloc] initWithNibName:@"ViewControllerthree" bundle:[NSBundle mainBundle]];

    Controller.Title = [item objectForKey:@"Title"];
UIViewController *rootController = 
    [[ViewControllerOne alloc] 
     initWithNibName:@"ViewControllerOne" bundle:nil];

    navigationController = [[UINavigationController alloc]
                            initWithRootViewController:rootController];

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    [self.window addSubview:navigationController.view];
    [self.window makeKeyAndVisible];
 [self.navigationController pushViewController:Controller animated:YES];
    Controller = nil;

And voila!

Good Luck, Nathan

Blazer
  • 13,862
  • 3
  • 28
  • 52
0

If there is no "Back" button, how will you dismiss the UIViewController?

To hide the "Back" button use the following:

self.navigationItem.hidesBackButton = YES;
bbarnhart
  • 6,230
  • 1
  • 37
  • 57