SplitView Question

Hi,

if you look at these screenshot, are iOSTables with round corners in Xojo possible? Does anyone have a declare?

And, is it possible to show/hide a split view in landscape mode? This is possible in iAWriter or Ulysses (fifth button from the right side) via Toolbutton Click.

Yes both are possible.
I’ll check the declares I have when I get back to my Mac

Actually rounded corners on grouped cells like the Settings app is very complicated. I do not have a Xojo solution for this.
https://stackoverflow.com/questions/18822619/ios-7-tableview-like-in-settings-app-on-ipad

I only have a solution for setting the entire table rounded corners.

[code]Declare Function layer_ Lib UIKitLib selector “layer” (id As ptr) As Ptr
Dim layer As ptr = layer_(table.Handle)

Declare Sub setCornerRadius Lib QuartzCoreLib selector “setCornerRadius:” (id As ptr, value As CGFloat)

setCornerRadius layer, 8

Declare Sub clipsToBounds Lib UIKitLib selector “setClipsToBounds:” (id As ptr, value As Boolean)
clipsToBounds(table.Handle, True)[/code]


To hide the left panel in a split view add this enumeration in a module

Protected Enum UISplitViewControllerDisplayMode Automatic PrimaryHidden AllVisible PrimaryOverlay End Enum

And then this function

[code]Public Sub SetDisplayMode(Extends scr As iOSSplitView, mode As UISplitViewControllerDisplayMode)
//Changes the SplitView in portrait mode

Declare Sub setPreferredDisplayMode Lib “UIKit” _
selector “setPreferredDisplayMode:” (obj As Ptr, mode As UISplitViewControllerDisplayMode)

setPreferredDisplayMode(scr.ViewControllerHandle, mode)

End Sub
[/code]

Or you could just use iOSDesignExtensions https://github.com/jkleroy/iOSDesignExtensions

Thanks for your input Jeremy. I already use your pretty cool iOSDesignExtensions. Could you please create a small sample project with both declares? Using SetDisplayMode within a View crashes the App:

iOSSplitView(App.CurrentScreen.Content).SetDisplayMode(ViewExtensionsXC.UISplitViewControllerDisplayMode.PrimaryHidden)

I copy pasted your code into a new project, imported iOSDesignExtensions and I don’t experience any crash.

https://www.jeremieleroy.com/upload/split.xojo_binary_project

A somewhat similar question so posting here rather than starting a new thread.

I have an iPad app that uses split mode in landscape only. when the user taps a button, I want the app to show a photo in the Details view display full screen AND allow the user to draw on the photo with finger or stylus.

Setting the display mode to PrimaryHidden almost works except that when the user starts drawing on the photo, the system interprets it as a swipe and displays the Primary/Master panel temporarily. From reading the Apple documentation, it seems what I want to do is set the isCollapsed property to True rather than setting the display mode to PrimaryHidden.

Is that what I want to do and if so what declares are necessary to do that (and then set isCollapsed to False again after the user finished editing and taps a close button). Alternative strategies welcome!

(Pre-iOS 13, I did this using a modal view which worked wonderfully, but of course does not work now because drawing in the model view is also interpreted as a swipe)

Untested

[code]Declare Sub collapsed Lib “UIKit” selector “collapsed:” (obj As Ptr, value As Boolean)

collapsed(App.CurrentScreen.ViewControllerHandle, true)
OR
collapsed(App.CurrentScreen.content.ViewControllerHandle, true)
[/code]

Thanks, Jeremie. Unfortunately, both versions crash the simulator and replacing “collapsed” with “isCollapsed” suffers the same fate. I also tried “Self.ParentSplitView.ViewControllerHandle” in place of “App.CurrentScreen.content.ViewControllerHandle” with the same result.

I appreciate you taking the time to give it some thought.

Collapsed is actually read-only. You can’t set a value to it.
https://developer.apple.com/documentation/uikit/uisplitviewcontroller/1623185-collapsed?language=objc

When you need to hide the master view call this:

Declare Sub presentsWithGesture Lib "UIKit" selector "setPresentsWithGesture:" (obj As Ptr, value As Boolean) presentsWithGesture(app.CurrentScreen.Content.ViewControllerHandle, false)

And set the display to PrimaryHidden

[quote=476742:@Jeremie Leroy]When you need to hide the master view call this:

Declare Sub presentsWithGesture Lib “UIKit” selector “setPresentsWithGesture:” (obj As Ptr, value As Boolean)
presentsWithGesture(app.CurrentScreen.Content.ViewControllerHandle, false)
And set the display to PrimaryHidden[/quote]

Perfect! Thanks so much!