cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shazron Abdullah (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CB-5265) Status Bar Plugin/Camera Plugin. Taking a photo or choosing a photo from library makes the status bar style back to black.
Date Wed, 27 Nov 2013 23:30:41 GMT

    [ https://issues.apache.org/jira/browse/CB-5265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13834340#comment-13834340
] 

Shazron Abdullah edited comment on CB-5265 at 11/27/13 11:30 PM:
-----------------------------------------------------------------

Ok here's a patch, replace the CDVCameraPicker class implementation in CDVCamera.m -- tested
with *UIViewControllerBasedStatusBarAppearance* set to either value. Note that the fix does
*not* hide the statusbar but changes the statusbar style. Because it does not hide the statusbar,
the  appearance of the *UIImagePickerController* differs based on the value of the *UIViewControllerBasedStatusBarAppearance*
setting (true hides the statusbar, false does not). 

We could make it both "match" if we don't hide the statusbar (prefersStatusBarHidden = false)
and (preferredStatusBarStyle = default), but this breaks the previous visual expectation but
it should be low risk.

{code}
@interface CDVCameraPicker()
{
    UIStatusBarStyle _prevStatusBarStyle; // _previous is private to UIImagePickerController!
}

@end

@implementation CDVCameraPicker

@synthesize quality, postUrl;
@synthesize returnType;
@synthesize callbackId;
@synthesize popoverController;
@synthesize targetSize;
@synthesize correctOrientation;
@synthesize saveToPhotoAlbum;
@synthesize encodingType;
@synthesize cropToSize;
@synthesize webView;
@synthesize popoverSupported;

- (BOOL)prefersStatusBarHidden {
    return YES;
}

- (UIViewController*)childViewControllerForStatusBarHidden {
    return nil;
}

- (void) refreshStatusBarStyle
{
    SEL sel = NSSelectorFromString(@"setNeedsStatusBarAppearanceUpdate");
    if ([self respondsToSelector:sel]) {
        [self performSelector:sel withObject:nil afterDelay:0];
    }
}
    
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    // fix for CB-5265 (Apple bug!!)
    _prevStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;

    [self refreshStatusBarStyle];
}

- (void)viewWillDisappear:(BOOL)animated {
    // fix for CB-5265 (Apple bug!!)
    [UIApplication sharedApplication].statusBarStyle = _prevStatusBarStyle;
    
    [self refreshStatusBarStyle];
    [super viewWillDisappear:animated];
}


@end
{code}


was (Author: shazron):
Ok here's a patch, replace the CDVCameraPicker class implementation in CDVCamera.m -- tested
with *UIViewControllerBasedStatusBarAppearance* set to either value. Note that the fix does
*not* hide the statusbar but changes the statusbar style. Because it does not hide the statusbar,
the  appearance of the UIImagePickerController differs based on the value of the UIViewControllerBasedStatusBarAppearance
setting (true hides the statusbar, false does not). 

We could make it both "match" if we don't hide the statusbar (prefersStatusBarHidden = false)
and (preferredStatusBarStyle = default), but this breaks the previous implementation but it
should be low risk.

{code}
@interface CDVCameraPicker()
{
    UIStatusBarStyle _prevStatusBarStyle; // _previous is private to UIImagePickerController!
}

@end

@implementation CDVCameraPicker

@synthesize quality, postUrl;
@synthesize returnType;
@synthesize callbackId;
@synthesize popoverController;
@synthesize targetSize;
@synthesize correctOrientation;
@synthesize saveToPhotoAlbum;
@synthesize encodingType;
@synthesize cropToSize;
@synthesize webView;
@synthesize popoverSupported;

- (BOOL)prefersStatusBarHidden {
    return YES;
}

- (UIViewController*)childViewControllerForStatusBarHidden {
    return nil;
}

- (void) refreshStatusBarStyle
{
    SEL sel = NSSelectorFromString(@"setNeedsStatusBarAppearanceUpdate");
    if ([self respondsToSelector:sel]) {
        [self performSelector:sel withObject:nil afterDelay:0];
    }
}
    
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    // fix for CB-5265 (Apple bug!!)
    _prevStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;

    [self refreshStatusBarStyle];
}

- (void)viewWillDisappear:(BOOL)animated {
    // fix for CB-5265 (Apple bug!!)
    [UIApplication sharedApplication].statusBarStyle = _prevStatusBarStyle;
    
    [self refreshStatusBarStyle];
    [super viewWillDisappear:animated];
}


@end
{code}

> Status Bar Plugin/Camera Plugin. Taking a photo or choosing a photo from library makes
the status bar style back to black.
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CB-5265
>                 URL: https://issues.apache.org/jira/browse/CB-5265
>             Project: Apache Cordova
>          Issue Type: Bug
>    Affects Versions: 3.1.0
>         Environment: iOS 7
>            Reporter: Daniel Morgan
>              Labels: camera, ios7, statusbar
>
> We're using a black status bar and the StatusBarStyleLightContent to simulate the pre-iOS
7 status bar with the status bar plugin.  When a user takes a photo or choose from library
the status bar style goes back to black; making a black status bar  with black text. My quick
fix is to add in CDVCamera under navigationController:willShowViewController:animated to set
the status bar style back to white: [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];,
but of course this only works for me since I want the status bar style to be white everywhere
in my application.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message