Re: iOS - Hide Master view in a split view
Re: iOS - Hide Master view in a split view
- Subject: Re: iOS - Hide Master view in a split view
- From: Eric Gorr <email@hidden>
- Date: Thu, 24 Mar 2011 19:18:37 -0400
Sent from my iPhone
On Mar 24, 2011, at 7:11 PM, WT <email@hidden> wrote:
> On Mar 24, 2011, at 6:27 PM, Eric Gorr wrote:
>
>> I am trying to figure out how to hide the master view in a split view while in landscape mode. Searching, I found the suggestion to try:
>>
>> [[master view] setFrame:CGRectMake(0, 0, 0, 0)];
>> [[detail view] setFrame:splitBounds];
>>
>> However, this does not appear to work.
>
> What exactly doesn't work? Hiding or resizing the detail view?
The code has no effect at all.
>
>> What is the recommend method for hiding the master view in landscape mode so the detail view can make use of the entire screen?
>>
>> Thanks.
>
> I just ran a very quick test and the following code snippet successfully toggles between showing and hiding the master view:
>
> UIViewController* vc;
> vc = [splitViewController.viewControllers objectAtIndex: 0];
> vc.view.hidden = !vc.view.hidden;
>
> All you need to do then is adjust the frame of the detail view, which is the object at index 1 in the array splitViewController.viewControllers. Of course, you want to make sure that this code only runs when the device orientation is landscape and you'll want to cache the two frames the detail view will be having.
I don't think it is so easy to adjust the frame of the detail view considering the above code fails. I did try this, and, you're right, the master view will hide, but the detail view will not resize.
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden