CB-8988: Fix rotation on iOS/iPad (closes #46)

The viewController.interfaceOrientation passed to getImageName has not
yet been updated with the new orientation, even when the frame/bounds
change event has fired. Thus, the plugin never actually loads the
correct image for the new orientation. Instead, it poorly scales the
existing image.

This fix uses the statusBarOrientation property of the UIApplication
object to detect the actual orientation, and correctly load the right
image.

Signed-off-by: Shazron Abdullah <shazron@apache.org>
This commit is contained in:
Dan Polivy 2015-05-07 16:37:02 -07:00 committed by Shazron Abdullah
parent 6cc3d1f3fe
commit 87f3c3a3ac

View File

@ -204,7 +204,7 @@
// Sets the view's frame and image.
- (void)updateImage
{
NSString* imageName = [self getImageName:self.viewController.interfaceOrientation delegate:(id<CDVScreenOrientationDelegate>)self.viewController device:[self getCurrentDevice]];
NSString* imageName = [self getImageName:[[UIApplication sharedApplication] statusBarOrientation] delegate:(id<CDVScreenOrientationDelegate>)self.viewController device:[self getCurrentDevice]];
if (![imageName isEqualToString:_curImageName]) {
UIImage* img = [UIImage imageNamed:imageName];