0

I'm playing around with Master-Detail out of the box Template. I got it to run and even the Buttons are there on iPhone-Plus. Now I've some issues.

On the iPad and portrait mode the App always starts in DetailView, I found a workaround for at least getting an Back Button but I want to start in portrait mode with the MasterView as TableView(like on iPhone or at least whit master and Detail). When I hit the Back button the table slides in. (in Landscape is everything fine due to the split view)

Question:

  • How to start in MasterTableview when iPad is in portrait mode (like on iPhone incl. 6+)?

  • How to get rid of the tableview when row is selected and the "detail view" should appear. (only "detail view" should be visible)?

  • or at least how to approach the same behavior like the "setting" on iPad
Cœur
  • 37,241
  • 25
  • 195
  • 267
HongKongTom
  • 207
  • 1
  • 2
  • 11
  • I found a solution for Question No.3 – HongKongTom Aug 08 '15 at 11:24
  • I found a solution for Question No.3: The out of the box template doesn't implement the UISplitviewControllerDelegate in DetailViewController , so you have to add it. Further more add in ViewDidLoad: if let splitVCExists = self.splitViewController{ splitVCExists.preferredDisplayMode = UISplitViewControllerDisplayMode.AllVisible } That I got from http://stackoverflow.com/questions/4790804/split-view-in-portrait-mode?lq=1 – HongKongTom Aug 08 '15 at 11:34
  • Have you found the solution for No.1? I'm facing that issue. Thanks – NTNT Jul 03 '16 at 10:51

1 Answers1

3

I did found a second approach:(for Part 3) After adding the UISplitViewControllerDelegate to the DetailViewController put in the viewDidLoad this self.splitViewController!.preferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryOverlay. That will show both, but the DetailView is NOT adjusted to fit on the right side. If you want to show both Master and Detail (DetailView fit to the right) self.splitViewController!.preferredDisplayMode = UISplitViewControllerDisplayMode.AllVisible

self.splitViewController!.preferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryOverlay // for overlay Detail will be  hidden half
self.splitViewController!.preferredDisplayMode = UISplitViewControllerDisplayMode.AllVisible  // detail will fit into right 
HongKongTom
  • 207
  • 1
  • 2
  • 11