What’s the best way to get at the JuceUIViewController in UIViewComponentPeer?
never-mind got it.
[code]UIResponder* responder = ((UIView*) Desktop::getInstance().getComponent (0)->getWindowHandle()).nextResponder;
if ([responder isKindOfClass: [UIViewController class]])
{
UIViewController* controller = (UIViewController*) responder;
//xxx
}
[/code]
UIResponder Class Reference
Now the only suspect here is:
getComponent (0)
Is this always going to give me that one JuceUIView on iOS? Is there a better way to guaranty this?
Or should I use:
UIResponder* responder = ((UIView*) [[UIApplication sharedApplication].keyWindow.subviews objectAtIndex: 0]).nextResponder;
Since I’m already dealing with iOS stuff here, why not fall back on [UIApplication sharedApplication].keyWindow, there’s only one window on iOS.
Would this be more solid than:
Desktop::getInstance().getComponent (0)->getWindowHandle()
?
That zero index just scares me for some reason no matter what approach…
-Thanks
I’d probably opt for something like Component::getCurrentlyFocusedComponent() rather than using the Desktop class.