1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fix for iOS window position flicker.

This commit is contained in:
jules 2013-11-01 13:41:01 +00:00
parent fb3b5035aa
commit 5df76c5dd8

View file

@ -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<int> oldArea (component.getBounds());
const Rectangle<int> oldDesktop (desktop.getDisplays().getMainDisplay().userArea);
const_cast <Desktop::Displays&> (desktop.getDisplays()).refresh();
const_cast<Desktop::Displays&> (desktop.getDisplays()).refresh();
window.transform = Orientations::getCGTransformFor (desktop.getCurrentOrientation());
view.transform = CGAffineTransformIdentity;