0
votes

I am using SplitView first time in iPad. I have implement the app by using default behavior of UISplitViewController. But now i need to implement some different. Can we have same layout in portrait mode same as in landscape mode means in left half part the Master View and right half part will have Detail View. Master View should hide/unhide by the click on menu button(Left barbuttonitem) on DetailView. When Master view is displaying on left side then DetailView should take the half space of iPad(Portriate Mode) that is Right part and when user click on menu button to hide the Master View then DetailView should slide towards the left side and will take the full space of iPad(Portrait Mode). Example app Youtube iOS iPad App.the split view in portrait mode should show like this. And on click on "Hide Master" button Master View should slide to left and disappeared and Detail View will take whole space.

3
I have added an image.indu

3 Answers

1
votes

A quick glance at the docs shows that UISplitViewControllerDelegate has a -splitViewController:shouldHideViewController:inOrientation: method. Will that do what you want?

0
votes

here's a good example which can provide you what you are searching for, I hope it helps you. pleas let me know ^_^

0
votes

Call these methods . According to your requirement .

-(void)splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)pc
{
    self.masterBarButtonItem = barButtonItem;
    self.masterPopoverController = pc;

    barButtonItem.title = NSLocalizedString(@"Master", @"Master");

    [self.currentDetailController.navigationItem setLeftBarButtonItem:self.masterBarButtonItem animated:NO];
}

/* forward the message to the current detail view
 * all detail views must implement UISplitViewControllerDelegate
 */
-(void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
    self.masterBarButtonItem = nil;
    self.masterPopoverController = nil;

    [self.currentDetailController.navigationItem setLeftBarButtonItem:nil animated:NO];

}