Displaying an UITableView in a JUCE iOS app?


#1

I know very little about iOS programming, like obj-c or swift, but I would like to be able to display from my juce app something like that: http://cdn.iphonehacks.com/wp-content/uploads/2017/01/garageband-iphone-ios-alchemy-synth-4.png
which is , if I’m not wrong, a UITableView in a UIPopover.

For example , being able to replace the calls to juce::PopupMenu in the app by something like that would be quite convenient I think, it would give the app a more “native” feel. We would fill it with addItem and addSubMenu like a PopupMenu but it would display that tableview in popover instead of a juce::PopupMenu.

So I wonder if it is something that is possible to do with juce, using the UIViewComponent stuff ? Does it have good chances of being a success, or is it more likely to turn into a nightmare and require being an iOS expert ? Or would you recommend to make a juce component that tries to mimic the native component, instead of trying to wrap UIKit stuff ?


#2

Yes using UIViewComponent is the way to go here. However, you may find some subtle problems as the UIViewComponent is a real native view on top of JUCE components. JUCE uses a single native top-level view for all of it’s components. So things like z-order will not work anymore: you cannot put one JUCE component behind the UIViewComponent and another on top as both JUCE components are in one single native view. There are other subtle issues to do with converting between JUCE’s potentially scaled geometry and iOS’s native coordinates.


#3

Thanks, Fabian. After some thought, I think I will first try to code something that works a bit like the native widget using JUCE only , that sounds like the safest option, and I’m more confident I can do it :slight_smile:


#4

Here is some code to display UITableView on iOS – just replace your PopupMenu by IOSPopupMenu and you will get native iOS menus instead of the JUCE ones – it works nicely, even if I don’t think I’ll replace all my PopupMenus with this one.

ios_popup_menu.h (671 Bytes)

ios_popup_menu.mm (11.5 KB)