Using an iOS interface from Introjucer project


#1

Firstly, I have a project that I’m working on and now want to port it so the UI uses just the standard iOS UIKit (for now). There are a couple of reasons for this but the main one is for me to lean some Objective-C and the Apple APIs.

I finally got this to sort of work, using a completely iOS UIViewController and xib file. However I’m not sure on what juce creates initially so have to create a dummy document window, resize it and add my UIViewController’s view to it wrapped in a juce UIViewComponent. This seems like a bit of a hack and may have further complications down the road. Here is the code I have working:

[code]uiWindow = new DocumentWindow (“ReTune”, Colours::transparentWhite, DocumentWindow::allButtons);
uiWindow->setTitleBarHeight (0);
uiWindow->setVisible (true);
uiWindow->setFullScreen (true);

uiViewComponent = new UIViewComponent();
uiViewComponent->setView ((void*)[[[ReTuneViewController alloc] init] view]);
uiWindow->setContentNonOwned (uiViewComponent, false);
uiViewComponent->setVisible (true);
uiViewComponent->resizeToFitView();[/code]

What I would like to do is get the main UIWindow that juce creates somewhere so I can add my view to it directly and therefore deal with all the iOS messages myself. Is this possible? How have others dealt with the same issue?

Any pointers much appreciated.


#2

I don’t know if this can help you, but you could use Component::getWindowHandle()
http://www.rawmaterialsoftware.com/juce/api/classComponent.html#a0d340d822e9a91fc665d73bbe1e91d72

And there’s also this thread:
http://www.rawmaterialsoftware.com/viewtopic.php?f=4&t=7257&hilit=getwindowhandle