Popover height

When showing a modal screen as a popover or pageSheet (I can’t see the difference in these) is it possible to limit the hight so that more of the parent window is visible?

In my case the new window only has a few options to select and replaces what would be a popup menu in a desktop project.

If you are using iOSKit add this code after calling ShowModal:

Dim vc As new UIKit.UIViewController(screen.ViewControllerHandle)
Dim sz As Foundation.NSSize

sz = new Foundation.NSSize(540, 750) //width, height

vc.preferredContentSize = sz

That’s not doing anything.
Is there an update to UIKit that I should be using?

I might be using a modified version of iOSKit… I will have to check

It also depends whether you’re on a phone or a tablet. IIRC Modal views are always full screen on phone.

So how does an app like maps work with the half size window coming up from thr bottom?

Well first of all, that’s not modal.

Am I missing other options that I should be aware of?

So what is it and how can we get this done with Xojo?

1 Like


There is also ShowModal perhaps these are the difference

I believe you are looking for something similar to this:

I checked the source-code it could take a week’s time of work to make something similar in Xojo.

That’s what I am looking for. But it’s not worth a week’s effort at this point.

Thanks for the response.

There are other design techniques to do something similar with limited functionality.

If you create the popover UI in a MobileContainer (let’s call it ccPopup), you can make it to be modal in some way.
In your MobileScreen, place a full screen Container (let’s call it ccBackground) with a semi-transparent background color.
In ccBackground add ccPopup at a specified size and position.

ccBackground covers the entire screen, except for the NavigationBar, and forces the user to press some button to dismiss the popup.

Example project: https://www.jeremieleroy.com/upload/iOS_Simple_Popup.xojo_binary_project


I’m doing the same thing here with the ccBackground semi transparent but a bit darker and ccPopup is used as just a message box with no animation.

1 Like

That’s awesome.

1 Like

How do you get the background (semi-transparent part) to cover the tabs at the bottom and the status bar at the top?

With layout constraints in code. This is the code.

messageBox_YesNo_Container is the MobileContainer with the semi-transparent background and the message box.
scrMessageBox is a global property (not sure if that’s relevant).
ms is the active MobileScreen.

scrMessageBox = new MobileScrollableArea
var cc as new messageBox_YesNo_Container

scrMessageBox.Container = cc
ms.AddControl scrMessageBox

var consTop as new iOSLayoutConstraint(scrMessageBox, iOSLayoutConstraint.AttributeTypes.Top, _
iOSLayoutConstraint.RelationTypes.Equal, ms, iOSLayoutConstraint.AttributeTypes.Top, 1, 0)

var consBottom as new iOSLayoutConstraint(scrMessageBox, iOSLayoutConstraint.AttributeTypes.Bottom, _
iOSLayoutConstraint.RelationTypes.Equal, ms, iOSLayoutConstraint.AttributeTypes.Bottom, 1, 0)

ms.AddConstraint consTop
ms.AddConstraint consBottom