KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
So I created a UINavigationController manually, set it as my UIWindow's rootViewController, and I would like to use a back button to exit the UINavigationController and load another viewController in its place. However, the backItem property of the UINavigationBar is readonly , so I don't know how to set it properly (it is readonly and defaults to nil in the root navigation view). How can I achieve this (or similar effect, I want to be able to effectively "exit" this UINavigationController by pressing the back button on the root view). Alternatively, is this bad form? How should I escape the root view of a UINavigationController ? EDIT: Attempted Legolas' solution with the following code: (some names have been changed) UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:plvc]; // plvc being the first viewcontroller MyAppDelegate* appDelegate = [Utility getAppDelegate]; appDelegate.window.rootViewController = navController; UIBarButtonItem* backButton = [[UIBarButtonItem alloc] initWithTitle:@"Start" style:UIBarButtonItemStyleBordered target:self action:@selector(initializeStuff)]; navController.navigationItem.leftBarButtonItem = backButton; [navController.navigationItem setHidesBackButton:YES animated:YES]; [navController.view setNeedsDisplay]; But the button does not display. What am I doing wrong? The other back buttons display properly, but this one still does not.
Tags (comma-separated)
Save Edits
Cancel