Creating an iPad Mail type UI using UISplitViewController
Hi, I'm trying to create an iPad application with a similar user interface to Apple's Mail application, i.e:
- RootView controller (table view) on the left hand side of the split view for navigation with a multiple view hierarchy. When a table cell is selected a new table view is pushed on the left hand side
- The new view on the left hand side can then update the detail view (potentially displaying a new view like the Apple MultipleDetailViews code sample).
I have modified the standard Xcode UISplitViewController template so that when a user selects a table cell from the left view it pushes a new table view in it's place (still on the left side). This works without issue, but I can no longer update the detail view using detailViewController.detailItem = [detailItem description];
I've also tried changing the MultipleDetailViews code sample, but have also had difficulty updating a label in the detail view.
Has anyone seen any examples of applications using the method I have described? - Multiple table views used on the left side of a splitViewController for navigation?
Or am attempting to do something that is only possible using private APIs?
For anyone who is interested in the solution (taken from another site):
"At some point after creating the RootViewController (or maybe even in a custom init method) you are setting the delegate for the DetailViewController, its a common mistake that when a new rootViewController is pushed onto the NavController that you forget to set the delgate again."
I'm trying to do the same application you described but I'm stuck,I can't even push a new view table.
Would you mind to post your source code?
It would be really helpful.Thanks
Quote:
Originally Posted by KSoza
For anyone who is interested in the solution (taken from another site):
"At some point after creating the RootViewController (or maybe even in a custom init method) you are setting the delegate for the DetailViewController, its a common mistake that when a new rootViewController is pushed onto the NavController that you forget to set the delgate again."
I can't really post the entire code, but here is how the push table view part works:
Start a new "Select Split View-based Application" project, add a new ViewController to the project and name it something relevant, (remember to select UITableViewController subclass).
Find the RootViewController.m file and add this code:
#import "NewNavViewController.h" // name of your new ViewController
// add this part to the didSelectRowAtIndexPath delegate
NewNavViewController *newNavViewController = [[NewNavViewController alloc] initWithNibName:@"NewNavViewController" bundle:nil];
[self.navigationController pushViewController:newNavViewController animated:YES];
[newNavViewController release];
Run the app and it should work (make sure you have set up your new ViewController with some table view content).
Finally I figure out how to populate the tables.
I forgot to put the instruction: [rvController.tableView reloadData];
where rvController is the RootController of the UISplitViewController.
Without the previous instruction data won't be reloaded inside the table and you will see only an empty table.
If you want to populate the table with your data,just edit "data.plist".
Now I have to understand how to load onto the detailViewController a different UITable for every row I select in the rootViewController.
If someone have a clue how to do it,please post a solution.Source code would be much more appreciated
Sorry if I bother you but I'm still trying to solve this problem(I want to push a new detail view when I select a table's row in the rootcontroller),and when I was looking for a solution a found a question you asked in Stackoverflow (iPad SplitViewController UI - Replicate Apple Mail App - Stack Overflow).
I can't understand how to use NSNotification...
Can you help me?Thanks
hi everyone. new to the forum.
i followed what you did here and managed to get the new viewcontroller to be pushed.
but am having two issues, if you could help me with:
1. the row that is selected on the first view controller remains selected after the new controller is pushed. if i press the back button is still remains selected.
2. i've gone through IB and changed the navigation bar color to dark gray (steel)
if i push the controller back and forth in portrait, and then rotate the ipad to landscape, the navigationbar color defaults to silver.
can anyone help me these two probs?
thanks in advance.
PS.... as it works well, just curious:
if say, row4 is selected, I wanted a new detailview to be pushed into view, how would that be accomplished?
I tried the MultipleDetailView sample from Apple, but no luck.
Finally I figure out how to populate the tables.
I forgot to put the instruction: [rvController.tableView reloadData];
where rvController is the RootController of the UISplitViewController.
Without the previous instruction data won't be reloaded inside the table and you will see only an empty table.
If you want to populate the table with your data,just edit "data.plist".
Now I have to understand how to load onto the detailViewController a different UITable for every row I select in the rootViewController.
If someone have a clue how to do it,please post a solution.Source code would be much more appreciated
Thanks
@Metronic thanks a lot for the code...
Saved my efforts in reinventing the wheel.