Control over both screens on iPad Split view

Is it possible to create a rectangle which covers the iPad’s entire screen when I have a split view? Preferably in code. Right now I’m using the MobileScreen’s left and right but as expected, that only covers one screen not the other. I experimented with iOSLayout and App.CurrentLayout but other than a few crashes I’ve got nothing to show for it.

https://stackoverflow.com/a/48238816/1240982
declare function NSClassFromString lib "Foundation" (clsName as CFStringRef) as ptr
Declare Function sharedApplication Lib "UIKit" Selector "sharedApplication" (obj As Ptr) As Ptr
Dim sharedApp As Ptr = sharedApplication(NSClassFromString("UIApplication"))


Declare Function keyWindow Lib "UIKit" selector "keyWindow" (obj_id As ptr) As ptr


Dim mainWindow As Ptr = keyWindow(sharedApp)

//cc is a property on the view
cc = new Container1 //Container1 is a MobileContainer with a black rectangle

declare sub addSubview lib "UIKit" selector "addSubview:" (obj_id as ptr, subview as ptr)
addSubview(mainWindow, cc.Handle)

I was wondering the same lately.

You will need to find a way to resized the container to mainWindow.frame which can be retrieved with iOSDesignExtensions I guess

1 Like

Thank you Jeremie. Your code works, the container shows but I can’t seem to find a way to resize it. I have found another solution though: I add the rectangle to a MobileScreen whose background color is set to transparent (with the help of your iOSDesignExtensions) and I will call the MobileScreen to show modally:

var ms as new Screen1 //Screen1's background color is transparent and it has the rectangle
ms.ShowModal(self, MobileScreen.ModalPresentationStyles.OverFullScreen, false)
1 Like