UI: fix some animations when changing of view - still having view on top of status bar in landscape mode and fix upsidedown

This commit is contained in:
Gautier Pelloux-Prayer 2015-12-03 16:42:38 +01:00
parent 41714551f9
commit 5a99184450
5 changed files with 54 additions and 56 deletions

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
</dependencies> </dependencies>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="PhoneMainView"> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="PhoneMainView">
@ -23,17 +24,21 @@
<view tag="1" contentMode="scaleToFill" id="avX-6g-QDq" userLabel="background"> <view tag="1" contentMode="scaleToFill" id="avX-6g-QDq" userLabel="background">
<rect key="frame" x="0.0" y="0.0" width="375" height="559"/> <rect key="frame" x="0.0" y="0.0" width="375" height="559"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view> </view>
<view 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="375" height="20"/> <rect key="frame" x="0.0" y="0.0" width="375" height="20"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<animations/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</view> </view>
</subviews> </subviews>
<animations/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</view> </view>
</subviews> </subviews>
<animations/>
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/> <simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
</view> </view>
@ -42,9 +47,4 @@
<nil key="simulatedStatusBarMetrics"/> <nil key="simulatedStatusBarMetrics"/>
</viewController> </viewController>
</objects> </objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document> </document>

View file

@ -79,7 +79,7 @@
</view> </view>
<view clearsContextBeforeDrawing="NO" tag="4" contentMode="scaleToFill" id="JXU-o0-1po" userLabel="sideMenuView"> <view clearsContextBeforeDrawing="NO" tag="4" contentMode="scaleToFill" id="JXU-o0-1po" userLabel="sideMenuView">
<rect key="frame" x="0.0" y="42" width="667" height="333"/> <rect key="frame" x="0.0" y="42" width="667" height="333"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/> <animations/>
</view> </view>
</subviews> </subviews>

View file

@ -268,37 +268,37 @@
[firstResponder resignFirstResponder]; [firstResponder resignFirstResponder];
[firstResponder becomeFirstResponder]; [firstResponder becomeFirstResponder];
} }
} }
+ (UIView *)findFirstResponder:(UIView *)view { + (UIView *)findFirstResponder:(UIView *)view {
if (view.isFirstResponder) { if (view.isFirstResponder) {
return view; return view;
}
for (UIView *subView in view.subviews) {
UIView *ret = [UICompositeView findFirstResponder:subView];
if (ret != nil)
return ret;
}
return nil;
} }
for (UIView *subView in view.subviews) {
UIView *ret = [UICompositeView findFirstResponder:subView];
if (ret != nil)
return ret;
}
return nil;
}
- (void)clearCache:(NSArray *)exclude { - (void)clearCache:(NSArray *)exclude {
for (NSString *key in [viewControllerCache allKeys]) { for (NSString *key in [viewControllerCache allKeys]) {
bool remove = true; bool remove = true;
if (exclude != nil) { if (exclude != nil) {
for (UICompositeViewDescription *description in exclude) { for (UICompositeViewDescription *description in exclude) {
if ([key isEqualToString:description.content] || [key isEqualToString:description.statusBar] || if ([key isEqualToString:description.content] || [key isEqualToString:description.statusBar] ||
[key isEqualToString:description.tabBar] || [key isEqualToString:description.sideMenu]) { [key isEqualToString:description.tabBar] || [key isEqualToString:description.sideMenu]) {
remove = false; remove = false;
break; break;
}
} }
} }
if (remove) {
LOGI(@"Free cached view: %@", key);
[viewControllerCache removeObjectForKey:key];
}
} }
if (remove) {
LOGI(@"Free cached view: %@", key);
[viewControllerCache removeObjectForKey:key];
}
}
} }
- (UIInterfaceOrientation)currentOrientation { - (UIInterfaceOrientation)currentOrientation {
@ -390,21 +390,22 @@
if (oldViewDescription != nil && self.viewTransition != nil) { if (oldViewDescription != nil && self.viewTransition != nil) {
[self.contentView.layer removeAnimationForKey:@"transition"]; [self.contentView.layer removeAnimationForKey:@"transition"];
[self.contentView.layer addAnimation:self.viewTransition forKey:@"transition"]; [self.contentView.layer addAnimation:self.viewTransition forKey:@"transition"];
if (oldViewDescription.statusBar != currentViewDescription.statusBar || if (![oldViewDescription.statusBar isEqualToString:currentViewDescription.statusBar] ||
oldViewDescription.statusBarEnabled != currentViewDescription.statusBarEnabled || oldViewDescription.statusBarEnabled != currentViewDescription.statusBarEnabled) {
[self.statusBarView.layer animationForKey:@"transition"] != nil) {
[self.statusBarView.layer removeAnimationForKey:@"transition"]; [self.statusBarView.layer removeAnimationForKey:@"transition"];
[self.statusBarView.layer addAnimation:self.viewTransition forKey:@"transition"]; [self.statusBarView.layer addAnimation:self.viewTransition forKey:@"transition"];
} else {
[self.statusBarView.layer removeAnimationForKey:@"transition"];
} }
if (oldViewDescription.tabBar != currentViewDescription.tabBar || if (![oldViewDescription.tabBar isEqualToString:currentViewDescription.tabBar] ||
oldViewDescription.tabBarEnabled != currentViewDescription.tabBarEnabled || oldViewDescription.tabBarEnabled != currentViewDescription.tabBarEnabled) {
[self.tabBarView.layer animationForKey:@"transition"] != nil) {
[self.tabBarView.layer removeAnimationForKey:@"transition"]; [self.tabBarView.layer removeAnimationForKey:@"transition"];
[self.tabBarView.layer addAnimation:self.viewTransition forKey:@"transition"]; [self.tabBarView.layer addAnimation:self.viewTransition forKey:@"transition"];
} else {
[self.tabBarView.layer removeAnimationForKey:@"transition"];
} }
if (oldViewDescription.sideMenu != currentViewDescription.sideMenu || if (![oldViewDescription.sideMenu isEqualToString:currentViewDescription.sideMenu] ||
oldViewDescription.sideMenuEnabled != currentViewDescription.sideMenuEnabled || oldViewDescription.sideMenuEnabled != currentViewDescription.sideMenuEnabled) {
[self.sideMenuView.layer animationForKey:@"transition"] != nil) {
[self.sideMenuView.layer removeAnimationForKey:@"transition"]; [self.sideMenuView.layer removeAnimationForKey:@"transition"];
[self.sideMenuView.layer addAnimation:self.viewTransition forKey:@"transition"]; [self.sideMenuView.layer addAnimation:self.viewTransition forKey:@"transition"];
} }
@ -582,8 +583,8 @@
sideMenuFrame.size.height += tabFrame.size.height; sideMenuFrame.size.height += tabFrame.size.height;
} else { } else {
sideMenuFrame = viewFrame; sideMenuFrame = viewFrame;
sideMenuFrame.size.height -= statusBarFrame.size.height; sideMenuFrame.size.height -= origin + statusBarFrame.size.height;
sideMenuFrame.origin.y = statusBarFrame.size.height; sideMenuFrame.origin.y = origin + statusBarFrame.size.height;
} }
if (!currentViewDescription.sideMenuEnabled) { if (!currentViewDescription.sideMenuEnabled) {

View file

@ -227,18 +227,14 @@ static RootViewManager *rootViewManagerInstance = nil;
} }
} }
//#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000
//- (UIInterfaceOrientationMask)supportedInterfaceOrientations - (UIInterfaceOrientationMask)supportedInterfaceOrientations
//#else #else
//- (NSUInteger)supportedInterfaceOrientations - (NSUInteger)supportedInterfaceOrientations
//#endif #endif
//{ {
// if ([LinphoneManager runningOnIpad] || [mainViewController currentViewSupportsLandscape]) { return UIInterfaceOrientationMaskAll;
// return UIInterfaceOrientationMaskAll; }
// } else {
// return UIInterfaceOrientationMaskPortrait;
// }
//}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration { duration:(NSTimeInterval)duration {

View file

@ -84,6 +84,7 @@
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array> </array>
<key>UISupportedInterfaceOrientations~ipad</key> <key>UISupportedInterfaceOrientations~ipad</key>
<array> <array>