Access to JuceUIViewController

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;

UIResponder Class Reference

Now the only suspect here is:

Is this always going to give me that one JuceUIView on iOS? Is there a better way to guaranty this?

Or should I use:

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:


That zero index just scares me for some reason no matter what approach…


I’d probably opt for something like Component::getCurrentlyFocusedComponent() rather than using the Desktop class.