Skip to content
Permalink
Browse files
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>
  • Loading branch information
dpolivy authored and shazron committed May 12, 2015
1 parent 6cc3d1f commit 87f3c3a3ac2c7c39f74f1173109377e87bd35078
Showing 1 changed file with 1 addition and 1 deletion.
@@ -204,7 +204,7 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
// 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];

0 comments on commit 87f3c3a

Please sign in to comment.