diff --git a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm index 110c07fe85..5f1975999f 100644 --- a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm @@ -106,6 +106,12 @@ using namespace juce; - (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation; - (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) toInterfaceOrientation duration: (NSTimeInterval) duration; - (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation; + +- (void) viewDidLoad; +- (void) viewWillAppear: (BOOL) animated; +- (void) viewDidAppear: (BOOL) animated; +- (void) viewWillLayoutSubviews; +- (void) viewDidLayoutSubviews; @end //============================================================================== @@ -113,7 +119,6 @@ using namespace juce; { @private UIViewComponentPeer* owner; - bool isZooming; } - (void) setOwner: (UIViewComponentPeer*) owner; @@ -323,6 +328,16 @@ private: [self viewDidLoad]; } +- (void) viewWillLayoutSubviews +{ + [self viewDidLoad]; +} + +- (void) viewDidLayoutSubviews +{ + [self viewDidLoad]; +} + @end @implementation JuceUIView @@ -428,7 +443,6 @@ private: - (void) setOwner: (UIViewComponentPeer*) peer { owner = peer; - isZooming = false; } - (void) becomeKeyWindow @@ -492,28 +506,27 @@ UIViewComponentPeer::UIViewComponentPeer (Component& comp, const int windowStyle } else { - controller = [[JuceUIViewController alloc] init]; - controller.view = view; - r = convertToCGRect (rotatedScreenPosToReal (component.getBounds())); r.origin.y = [UIScreen mainScreen].bounds.size.height - (r.origin.y + r.size.height); - window = [[JuceUIWindow alloc] init]; + window = [[JuceUIWindow alloc] initWithFrame: r]; + [((JuceUIWindow*) window) setOwner: this]; + + controller = [[JuceUIViewController alloc] init]; + controller.view = view; + window.rootViewController = controller; + window.hidden = true; window.autoresizesSubviews = NO; - window.transform = CGAffineTransformIdentity; - window.frame = r; + window.transform = Orientations::getCGTransformFor (Desktop::getInstance().getCurrentOrientation()); window.opaque = component.isOpaque(); window.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent: 0]; - [((JuceUIWindow*) window) setOwner: this]; - if (component.isAlwaysOnTop()) window.windowLevel = UIWindowLevelAlert; view.frame = CGRectMake (0, 0, r.size.width, r.size.height); - window.rootViewController = controller; [window addSubview: view]; } @@ -629,7 +642,7 @@ void UIViewComponentPeer::updateTransformAndScreenBounds() const Rectangle oldArea (component.getBounds()); const Rectangle oldDesktop (desktop.getDisplays().getMainDisplay().userArea); - const_cast (desktop.getDisplays()).refresh(); + const_cast (desktop.getDisplays()).refresh(); window.transform = Orientations::getCGTransformFor (desktop.getCurrentOrientation()); view.transform = CGAffineTransformIdentity;