Fix the status bar color in a better fashion.

This commit is contained in:
Guillaume BIENKOWSKI 2014-06-02 17:04:50 +02:00
parent 44995825d7
commit 0e49bd4e7c
2 changed files with 13 additions and 19 deletions

View file

@ -472,26 +472,20 @@ static PhoneMainView* phoneMainViewInstance=nil;
// In iOS7, the app has a black background on dialer, incoming and incall, so we have to adjust the
// status bar style for each transition to/from these views
BOOL toLightStatus = (to_view != NULL) && ![PhoneMainView isDarkBackgroundView:to_view];
BOOL fromLightStatus = ![PhoneMainView isDarkBackgroundView:currentView];
if( !toLightStatus ) {
// black bg: white text on black background
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
if(statusBarBG.hidden == YES){
statusBarBG.alpha = 0;
statusBarBG.hidden = NO;
[UIView animateWithDuration:0.3f
animations:^{statusBarBG.alpha = 1;} ];
}
} else if(!fromLightStatus && toLightStatus) {
[UIView animateWithDuration:0.3f
animations:^{statusBarBG.backgroundColor = [UIColor blackColor];} ];
} else {
// light bg: black text on white bg
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
if( statusBarBG.hidden == NO ){
[UIView animateWithDuration:0.3f
animations:^{ statusBarBG.alpha = 0; }
completion:^(BOOL finished) {statusBarBG.hidden = YES;}];
}
[UIView animateWithDuration:0.3f
animations:^{ statusBarBG.backgroundColor = [UIColor colorWithWhite:0.935 alpha:1]; }];
}
#endif
}

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1280" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
<deployment defaultVersion="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="PhoneMainView">
@ -22,7 +22,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
</imageView>
<view hidden="YES" contentMode="scaleToFill" id="6sv-JD-j8Z" userLabel="statusBarBG">
<view contentMode="scaleToFill" id="6sv-JD-j8Z" userLabel="statusBarBG">
<rect key="frame" x="0.0" y="0.0" width="320" height="20"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
@ -42,4 +42,4 @@
<resources>
<image name="background.png" width="640" height="523"/>
</resources>
</document>
</document>