How to switch page on UINavigationBar on iPhone
I want to ask a question about the UI item on the UINavigationBar on the iPhone application. Im my program, there are a navigation bar and UITableView, like the following structure.
UIView (DataRootViewController.m)
|
+- UINavigationBar
|
+- UITableView
And, I want the it display the detail of the data when the user press one of the cell on the UITableView.
However, I don't know what should I do. I just create a class with UIViewController type (called DataDetailViewController.m) and leave it empty. What should I do for the next step? Which UI element should I add on the navigation bar i开发者_如何学Pythonn the detail view in order to let the user to go back to the basic page.
thank you very much.
You should be using a UINavigationController instead of trying to replicate the behavior. On your app delegate, try something like this.
RootViewController *rootViewController = [[RootViewController alloc] init];
UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
[window addSubview:[self.tabBarController view]];
Now, this RootViewController should have a table view, and when a user taps the table you should build your detail view controller and use
[[self.navigationController] pushViewController:myDetailViewController animated:(BOOL)animated];
精彩评论