Reputation: 5510
I have 3 UIViewControllers, I would like to be able to transition back and forward but not n any particular order witout any type of navigationcontroller.
So far I have set up a method in my delegate where I can remember which view I was last on if the application is removed from memory in the mutitask bar.
it looks like this
if (([projectListBoolString isEqualToString:@"T"]) && ([installsBoolString isEqualToString:@"F"]) && ([finishinBoolString isEqualToString:@"F"])) {
self.getProjectListViewController = [[GetProjectListViewController alloc] initWithNibName:@"GetProjectListViewController" bundle:nil];
self.window.rootViewController = self.getProjectListViewController;
[self.window makeKeyAndVisible];
}
else if (([projectListBoolString isEqualToString:@"T"]) && ([installsBoolString isEqualToString:@"T"]) && ([finishinBoolString isEqualToString:@"T"])) {
self.currentProjectListViewController = [[CurrentProjectListViewController alloc] initWithNibName:@"CurrentProjectListViewController" bundle:nil];
self.window.rootViewController = self.currentProjectListViewController;
[self.window makeKeyAndVisible];
}
else {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
}
Whoever when I am in the application I would like to know how to jump from one view to anther making sure only 1 view is ever in memory / loaded.
Upvotes: 1
Views: 245
Reputation: 319
if(getProjectListViewController == nil)
getProjectListViewController = new GetProjectListViewController ();
if(viewController.view.superview!=nil){
viewController.view.removefromSuperView();
window.addsubview(getProjectListViewController.view);
} else {
getProjectListViewController.view.removeFromSuperView();
window.addsubview(viewController.view);
}
Add if/else-if statements as needed for more than two views. You can also continue using a navController without the interface components if you still find that easier -- there's a hidden property you can utilise.
Upvotes: 1