Splitview masterview width

In a Splitview on iPad how can I make the master view half of the splitview, so that the master and detail are equal in width?

you can change the type of showing:

https://documentation.xojo.com/api/ios/iossplitview.html
See displayModes

I’m not sure it’s exactly possible. other than to put all the content in 2 containers and use a single view. But this will defeat the purpose of a splitview.

1 Like

Thanks!

I used a combination of displayMode to get the split in portrait mode and then added an extension method for declares for preferredPrimaryCol width, max and min column width. The min and max are the limiting factors.

This works well for my app in portrait and landscape orientations.

Declare Sub setPreferredPrimaryColumnWidthFraction Lib "UIKit" _
selector "setPreferredPrimaryColumnWidthFraction:" (obj As Ptr, fraction as Double)

setPreferredPrimaryColumnWidthFraction(scr.ViewControllerHandle, fraction)

Declare Sub setMinimumPrimaryColumnWidth Lib "UIKit" _
selector "setMinimumPrimaryColumnWidth:" (obj As Ptr, width as Double)

setMinimumPrimaryColumnWidth(scr.ViewControllerHandle, width)

Declare Sub setMaximumPrimaryColumnWidth Lib "UIKit" _
selector "setMaximumPrimaryColumnWidth:" (obj As Ptr, width as Double)

setMaximumPrimaryColumnWidth(scr.ViewControllerHandle, width)

I set it in the Opening event of the master view

// set up splitview on iPad
var splitview as iOSSplitView = self.ParentSplitView

If splitview <> Nil Then
  // we are iPad set the width and also master detail on portrait
  splitView.SetDisplayFraction(0.4, 400)
  splitview.displayMode = iOSSplitView.DisplayModes.AllVisible
end
1 Like

Frankly,I created a split view iPad app, and I really regret it.
Splitview doesn’t work on iPhones, and it doesnt exist on Android.
So it all needs to thrown away and re- jigged if I ever want to give Android another try. (gave up a few times so far)
If I was staring from scratch today, I’d probably ‘emulate’ split view with containers

It works much nicer for the end user if you use splitview. Diy this and you get a bad user experience.

Thanks for sharing this great solution. Perhaps putting this in ios designextentions wpuld be a good thing ? @Jeremie_L

Android people seem to get by?

Android is currently only for phones, not for tablets as far is know xojo has been clear on this.

Android is currently only for phones, not for tablets as far is know xojo has been clear on this.

The only difference I can see is the screen area. But it’s off topic, and the OP’s question is resolved, so I’ll go away.

Done! GitHub - jkleroy/iOSDesignExtensions: 100+ functions to extend iOSControls design

Thank you for the suggestion :slight_smile:

3 Likes