Better transitions for the statusbar in ios7

This commit is contained in:
Guillaume BIENKOWSKI 2013-11-07 12:23:30 +01:00
parent 696643b92b
commit 88c7705c1c
3 changed files with 112 additions and 97 deletions

View file

@ -50,8 +50,11 @@
NSTimer *batteryTimer;
}
@property (nonatomic, retain) IBOutlet UIView *statusBarBG;
@property (nonatomic, retain) IBOutlet UICompositeViewController *mainViewController;
@property (readonly) UICompositeViewDescription *currentView;
- (UIViewController*)changeCurrentView:(UICompositeViewDescription *)currentView;
- (UIViewController*)changeCurrentView:(UICompositeViewDescription *)currentView push:(BOOL)push;
- (UIViewController*)popCurrentView;

View file

@ -31,6 +31,7 @@ static PhoneMainView* phoneMainViewInstance=nil;
@synthesize mainViewController;
@synthesize currentView;
@synthesize statusBarBG;
#pragma mark - Lifecycle Functions
@ -413,24 +414,32 @@ static PhoneMainView* phoneMainViewInstance=nil;
[mainViewController setStateBarHidden:!show];
}
+ (BOOL)isLightBackgroundView:(UICompositeViewDescription*)view {
return ( [view equal:[DialerViewController compositeViewDescription]] ||
[view equal:[IncomingCallViewController compositeViewDescription]] ||
[view equal:[InCallViewController compositeViewDescription]] );
}
- (void)updateStatusBar:(UICompositeViewDescription*)to_view {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
if ([LinphoneManager runningOnIpad]) {
// In iOS7, the ipad has a black background on dialer, so we have to adjust the
// status bar style for each transition to/from this view
BOOL toLightStatus = [to_view equal:[DialerViewController compositeViewDescription]];
BOOL fromLightStatus = [currentView equal:[DialerViewController compositeViewDescription]];
if( (!to_view && fromLightStatus) || // this case happens at app launch
toLightStatus )
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
else if(fromLightStatus)
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
// 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 isLightBackgroundView:to_view];
BOOL fromLightStatus = [PhoneMainView isLightBackgroundView:currentView];
if( (!to_view && fromLightStatus) || toLightStatus ) {
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
[statusBarBG setHidden:NO];
} else if(fromLightStatus) {
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
[statusBarBG setHidden:YES];
}
#endif
}
- (void)fullScreen:(BOOL)enabled {
[statusBarBG setHidden:enabled];
[mainViewController setFullScreen:enabled];
}

View file

@ -1,32 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">784</int>
<string key="IBDocument.SystemVersion">11G63</string>
<string key="IBDocument.InterfaceBuilderVersion">2840</string>
<string key="IBDocument.AppKitVersion">1138.51</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<string key="IBDocument.SystemVersion">12F37</string>
<string key="IBDocument.InterfaceBuilderVersion">4510</string>
<string key="IBDocument.AppKitVersion">1187.39</string>
<string key="IBDocument.HIToolboxVersion">626.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1926</string>
<string key="NS.object.0">3742</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUIImageView</string>
<string>IBUIView</string>
<string>IBUIViewController</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@ -36,16 +33,21 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="891400674">
<reference key="NSNextResponder"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">301</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUIImageView" id="130212555">
<reference key="NSNextResponder" ref="891400674"/>
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{320, 480}</string>
<reference key="NSSuperview" ref="891400674"/>
<reference key="NSNextKeyView" ref="438728668"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor" id="1066568172">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
<string key="IBUIColorCocoaTouchKeyPath">darkTextColor</string>
</object>
<int key="IBUITag">1</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@ -54,14 +56,22 @@
<string key="NSResourceName">background.png</string>
</object>
</object>
</object>
<object class="IBUIView" id="438728668">
<reference key="NSNextResponder" ref="891400674"/>
<int key="NSvFlags">-2147483358</int>
<string key="NSFrameSize">{320, 20}</string>
<reference key="NSSuperview" ref="891400674"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<reference key="IBUIBackgroundColor" ref="1066568172"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<string key="NSFrameSize">{320, 480}</string>
<reference key="NSSuperview"/>
<reference key="NSNextKeyView" ref="130212555"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAwLjI4MzE1ODM3MjYgMC4wNTY3ODY4OTE2MQA</bytes>
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
@ -75,121 +85,114 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIHorizontal">NO</bool>
</object>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="891400674"/>
</object>
<int key="connectionID">158</int>
</object>
<bool key="usesAutoincrementingIDs">NO</bool>
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">mainViewController</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="839760968"/>
</object>
<int key="connectionID">209</int>
<string key="id">209</string>
</object>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="891400674"/>
</object>
<string key="id">WV3-Jd-QMD</string>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">statusBarBG</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="438728668"/>
</object>
<string key="id">CCl-1v-2B7</string>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<object class="NSArray" key="object" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<string key="id">0</string>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<string key="id">-1</string>
<reference key="object" ref="841351856"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<string key="id">-2</string>
<reference key="object" ref="450319686"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">152</int>
<string key="id">152</string>
<reference key="object" ref="891400674"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<array class="NSMutableArray" key="children">
<reference ref="130212555"/>
</object>
<reference ref="438728668"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">208</int>
<string key="id">208</string>
<reference key="object" ref="839760968"/>
<reference key="parent" ref="0"/>
<string key="objectName">mainViewController</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">212</int>
<string key="id">212</string>
<reference key="object" ref="130212555"/>
<reference key="parent" ref="891400674"/>
<string key="objectName">background</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-1.IBPluginDependency</string>
<string>-2.CustomClassName</string>
<string>-2.IBPluginDependency</string>
<string>152.IBPluginDependency</string>
<string>208.CustomClassName</string>
<string>208.IBPluginDependency</string>
<string>212.IBPluginDependency</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>PhoneMainView</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>UIResponder</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>UICompositeViewController</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
<object class="IBObjectRecord">
<string key="id">6sv-JD-j8Z</string>
<reference key="object" ref="438728668"/>
<reference key="parent" ref="891400674"/>
<string key="objectName">statusBarBG</string>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">PhoneMainView</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="152.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="208.CustomClassName">UICompositeViewController</string>
<string key="208.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="212.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6sv-JD-j8Z.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">217</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">YES</bool>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="784" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1072" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
<integer value="4600" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
@ -197,6 +200,6 @@
<string key="NS.key.0">background.png</string>
<string key="NS.object.0">{640, 523}</string>
</object>
<string key="IBCocoaTouchPluginVersion">1926</string>
<string key="IBCocoaTouchPluginVersion">3742</string>
</data>
</archive>