Hey folks - has anybody ever tried integrating JUCE Component objects into an Objective-C iOS app? From looking in the forums I’ve seen reference to a class called UIViewComponent. From the documentation I tried whipping something together but didn’t have any luck. The basic idea seems to be that you create a UIViewComponent derived class and then give at UIView to be hosted in.
I created a standalone example here, but it doesn’t work:
I want to be able to create a sophisticated JUCE Component in GeoShred (which is an iOS app written in Objjective-C)
I tried the following, and the attached example is a working demonstration. It’s a bit hard to even get something like this running because you have to create a static JUCE library. The library I am using is I think from one or two versions of JUCE back, but I need to use for my project. Now, if there is an example somewhere of how to drag the JUCE source code directly into an Objective-C project, I can consider that - actually I would like that - Anyway, here goes:
Create a new single window app in Objective-C
Rename the ViewController class ViewController.mm so
it can be Objective C++
Figure out how to include a static JUCE library and the JUCE
headers (the project I attached in the last message does this)
Make a simple derived class of UIViewComponent:
class MyComponent : public UIViewComponent
{
void paint(Graphics &g) overide {
DBG(“paint called”);
}
Now you’d hope to see the paint method getting called, it never happens,
in fact you’ll probably get a crash, unless you do the jive-ass stuff
I did in my example to call functions on the message thread etc.
No, you shouldn’t derive from UIViewComponent! Just add one as a member, make sure it’s visible and use setView() to pass in the native UIView that you’d like to display.