Modal view with a NavigationBar

Hi all,

is it possible to display a View in a modal mode and displaying the NavigationBar ?

The iOS Calendar App seems to be doing this when tapping the “+” button to add a new event:

and a second stack of navigation paths is handled.

I am displaying a modal view with the following code:

Declare Sub presentViewController Lib "UIKit" _ Selector "presentViewController:animated:completion:" _ (parentView As Ptr, viewControllerToPresent As Ptr, animated As Boolean, completion As Ptr)

Here is an example project.
The Modal view doesn’t display a NavigationBar and calling self.pushTo(new View) has no effect.

http://www.jeremieleroy.com/upload/modaltest.xojo_binary_project

You might well find that the Calendar app is faking it: that modal view might just have controls placed at the top that have been styled to look like the app’s main navigation bar.

That’s certainly the approach that I’ve taken with modal views in Xojo iOS. If anyone has a “proper” way of doing it, I’d love to hear about it.

Thanks for the suggestion Tom.

But would you know how to Push a new view from the Modal View ?
In the GIF above tapping on “Alert” in the modal view seems to push a new view for selection an element from a Table. This is the most troublesome feature I need for my app.

Ah, sorry, I missed that part. No, I haven’t tried to do that. In similar situations, I’ve ended up popping up a second modal view on top of the first.

Thanks I’ll go for the second modal view on top of the first.

Although this doesn’t seem to be a best practice, seems like the only workaround for the moment.