Tom Tallak Solbu
Tom Tallak Solbu

Reputation: 559

How to make the detailview and masterView communicate in the splitViewController?

I have a UISplitView with a masterView and a detailView. The masterView is a UITableViewController (inside a UINavigationControler) and the detailView is a UIViewController (also inside a UINavaigationController).

The UISplitView appears just fine with the masterView and an empty detailView. In masterView, I have this method:

 - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
       if (![self splitViewController])
       DetailViewController*myDetailView = [[DetailViewController alloc] init];
       Item *selectedItem = [items objectAtIndex:[indexPath row]];
       [myDetailView setItem:selectedItem];
       [[self navigationController] pushViewController:myDetailView animated:YES];
    }

This works fine for iPhone. For iPad, the detailView appears in the masterViewController, allbeit correctly, but the detailview remains empty.

How can I make myDetailview appear in the detailView (right side of the splitView)?

Upvotes: 1

Views: 226

Answers (1)

Charan
Charan

Reputation: 4946

I recommend you to use Matt gemmell's MGSplitViewController

He has customized everything in the split view controller, you can get the master at right side using this and its just weird that you said that UISplitViewController is working fine in iPhone

To be clear UISplitViewController is specific for iPad and not for iPhone

So, please have a knowledge of iPad specific controllers like UIPopOverController and UISplitViewController

In Doc's, you can read this in the first line it self

Split view controllers are for use exclusively on iPad devices.

 Attempting to create one on other devices results in an exception. 

Upvotes: 4

Related Questions