Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide & unhide Master View Controller in SplitView Controller

Tags:

I have created a new split view based project in my XCode 4.2

Then in DetailViewController.m file i have add this method

- (BOOL)splitViewController: (UISplitViewController*)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation  {   //This method is only available in iOS5       return NO; } 

Now by doing this i can able to show both left & right part of my splitview Controller at a time.

Now i have added a UIBarButtonItem in my DetailViewController Navigation bar and i want by using which i can hide & show my Master View both in Portrairt and Landscape Mode.

- (IBAction)hideUnhide:(id)sender  {  //How can hide & unhide  } 

How can i do this?

like image 313
user930195 Avatar asked Nov 05 '11 13:11

user930195


People also ask

How do I hide from people?

Your ability to hide will depend in part based on how much someone (if anyone) wants to find you. If you're trying to hide because you're in danger, it is strongly recommended that you find a way to leave the area as fast as possible. Get help if it's available.

How do I hide an icon in Windows 10?

Click “OK” to save your changes, and the Folder Options window will close. Go to your desktop and find the icon that you want to hide. Right-click it and select “Properties.” In the Properties window, click the “General” tab and then locate the “Attributes” section near the bottom of the window. Place a check mark beside “Hidden.”

How do you hide in a small space?

As soon as you decide on a hiding spot, crouch, stoop, or sit down and draw your arms and legs in. If you’re tucked away in a narrow space, stand up straight and put your arms down at your sides. The less room you take up, the harder you’ll be to see.

How to hide a column in Excel?

The shortcut to hide a column is Ctrl + 0. This article must be helpful to understand the hide column in Excel, with its formula and examples. You can download the template here to use it instantly.


2 Answers

instead spv.delegate=nil; spv.delegate=self; 

you need to do next:

[spv willRotateToInterfaceOrientation:self.interfaceOrientation duration:0]; 
like image 191
Philip J. Fry Avatar answered Sep 22 '22 16:09

Philip J. Fry


'setNeedsLayout' makes UISplitViewController to ask for "shouldHideViewController"

- (IBAction)hideUnhide:(id)sender  {     UISplitViewController* spv = ...;      self.hideMaster= !self.hideMaster;     [ spv.view setNeedsLayout ] } 
like image 29
Andrei Tchijov Avatar answered Sep 20 '22 16:09

Andrei Tchijov