• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to make UISplitViewController behave ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to make UISplitViewController behave ?


  • Subject: Re: How to make UISplitViewController behave ?
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Tue, 13 Oct 2015 11:25:03 +0700

> On 13 Oct 2015, at 04:49, David Duncan <email@hidden> wrote:
>
>
>> On Oct 11, 2015, at 11:21 PM, Gerriet M. Denkmann <email@hidden> wrote:
>>
>> iPad / iPhone Master-Detail app. iOS 9.0, Xcode 7.0
>>
>> Rotating the iPad to Portrait my AppDelegate will receive a UIDeviceOrientationDidChangeNotification:
>>
>> 12:23:01.182 -[AppDelegate iPadHasTurned:]
>> 	and does:
>> 	UISplitViewControllerDisplayMode newMode = PrimaryOverlay
>> 	splitViewController.preferredDisplayMode = newMode;
>> 	[ self performSelector: @selector(delayedSetMode:) withObject: @(newMode) afterDelay: 0 ];	//	see below
>>
>> 12:23:01.183 	-[AppDelegate splitViewController:willChangeToDisplayMode:] PrimaryOverlay
>> 	good, that's what I just have told it to do.
>>
>> 12:23:01.196 	-[MasterViewController viewDidAppear:]
>> 12:23:01.198 -[AppDelegate iPadHasTurned:] done
>>
>> So far so good.
>>
>> But now the pesky SplitViewController decides it knows best, and does:
>>
>> 12:23:01.199 -[AppDelegate splitViewController:willChangeToDisplayMode:] AllVisible
>>
>> here my delayedSetMode will come to the rescue:
>> 12:23:01.212 -[AppDelegate delayedSetMode:] displayMode → PrimaryOverlay
>> 	does: 	splitViewController.preferredDisplayMode = newMode;
>> 12:23:01.223 	-[MasterViewController viewDidAppear:]
>> 12:23:01.224 -[AppDelegate delayedSetMode:] done
>>
>> Is there a better way than this hack with delayedSetMode ?
>
> Why are you doing this?

I have defined two new displayModes, let’s call them UISplitViewControllerDisplayMode_FocusOnPrimary and UISplitViewControllerDisplayMode_FocusOnSecondary, or FocusOnPrimary and FocusOnSecondary for short.

They should work like this on iPad:
• Landscape: both Primary (Master) and Secondary (Detail) should be visible. Automatic works fine in this case.
• Portrait with FocusOnPrimary: Primary (Master) should be visible, leaving the Secondary (Detail) partly obscured. Like PrimaryOverlay.
• Portrait with FocusOnSecondary: Secondary (Detail) should be visible, completely hiding Primary. Like PrimaryHidden.

The use case is as follows:
• If the user shifts focus to Detail - e.g. by clicking on a row in the TableView of Master (which makes some info about this row show up in Detail), the Detail or Secondary should be completely visible (and remain visible), regardless of orientation of iPad.

• Similarly if the user clicks the “< Master” Back-Button (or goes back to Master by some other means) then the focus should be on Master; and Master should remain visible, regardless of orientation of iPad.

I have implemented these two new displayModes via UIDeviceOrientationDidChangeNotification.


When I just set PrimaryOverlay in Portrait (while shifting focus to Main), all is fine (for the time being). But when I then rotate iPad to Landscape only the Detail view is shown, which is wrong.


Kind regards,

Gerriet.


_______________________________________________

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


References: 
 >How to make UISplitViewController behave ? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: How to make UISplitViewController behave ? (From: David Duncan <email@hidden>)

  • Prev by Date: Re: How to make UISplitViewController behave ?
  • Next by Date: Re: Data not retained in document based core data app with cocoa bindings
  • Previous by thread: Re: How to make UISplitViewController behave ?
  • Next by thread: NSGraphicsContext currentContext() returns nil on OSX 10.11
  • Index(es):
    • Date
    • Thread