11import common = require( "utils/utils-common" ) ;
22import colorModule = require( "color" ) ;
3- import view = require( "ui/core/view" ) ;
43
54global . moduleMerge ( common , exports ) ;
65
@@ -60,14 +59,6 @@ export module ios {
6059 return new colorModule . Color ( alpha , red , green , blue ) ;
6160 }
6261
63- export function getActualHeight ( uiView : UIView ) : number {
64- if ( uiView . window && ! uiView . hidden ) {
65- return uiView . frame . size . height ;
66- }
67-
68- return 0 ;
69- }
70-
7162 export function isLandscape ( ) : boolean {
7263 var device = UIDevice . currentDevice ( ) ;
7364 var statusBarOrientation = UIApplication . sharedApplication ( ) . statusBarOrientation ;
@@ -76,72 +67,6 @@ export module ios {
7667 }
7768
7869 export var MajorVersion = NSString . stringWithString ( UIDevice . currentDevice ( ) . systemVersion ) . intValue ;
79-
80- export function _layoutRootView ( rootView : view . View , parentBounds : CGRect ) {
81- if ( ! rootView || ! parentBounds ) {
82- return ;
83- }
84-
85- var landscape = isLandscape ( ) ;
86- var iOSMajorVersion = MajorVersion ;
87- var size = parentBounds . size ;
88- var width = size . width ;
89- var height = size . height ;
90-
91- //trace.write("--------------------------------------------", "LayoutRootView.iOS");
92- //trace.write("| Layout Root View", "LayoutRootView.iOS");
93- //trace.write("| rootView: " + rootView, "LayoutRootView.iOS");
94- //trace.write("| parentBounds: " + NSStringFromCGRect(parentBounds), "LayoutRootView.iOS");
95- //trace.write("| UIScreen.mainScreen().bounds: " + NSStringFromCGRect(UIScreen.mainScreen().bounds), "LayoutRootView.iOS");
96- //trace.write("| _isModal: " + (<any>rootView)._isModal, "LayoutRootView.iOS");
97- //trace.write("| _UIModalPresentationFormSheet: " + (<any>rootView)._UIModalPresentationFormSheet, "LayoutRootView.iOS");
98- //trace.write("| landscape: " + landscape, "LayoutRootView.iOS");
99- //trace.write("| iOSMajorVersion: " + iOSMajorVersion, "LayoutRootView.iOS");
100- var superview = ( < UIView > rootView . _nativeView ) . superview ;
101- //trace.write("| superview: " + superview, "LayoutRootView.iOS");
102- var superViewRotationRadians ;
103- if ( superview ) {
104- superViewRotationRadians = atan2f ( superview . transform . b , superview . transform . a ) ;
105- //trace.write("| superViewRotationRadians: " + superViewRotationRadians + " rad.", "LayoutRootView.iOS");
106- //trace.write("| superview.bounds: " + NSStringFromCGRect(superview.bounds), "LayoutRootView.iOS");
107- }
108-
109- if ( iOSMajorVersion < 8 && landscape && ! superViewRotationRadians ) {
110- // in iOS 7 when in landscape we switch width with height because on device they don't change even when rotated.
111- //trace.write("| >>> Detected iOS 7 device in landscape mode and superview is not rotated. Manually swapping width and height...", "LayoutRootView.iOS");
112- width = size . height ;
113- height = size . width ;
114- }
115-
116- var statusBarHeight ;
117- if ( UIApplication . sharedApplication ( ) . statusBarHidden || ( ( < any > rootView ) . _UIModalPresentationFormSheet && ! CGSizeEqualToSize ( parentBounds . size , UIScreen . mainScreen ( ) . bounds . size ) ) ) {
118- statusBarHeight = 0 ;
119- }
120- else {
121- // Status bar section
122- var statusFrame = UIApplication . sharedApplication ( ) . statusBarFrame ;
123- try {
124- statusBarHeight = Math . min ( statusFrame . size . width , statusFrame . size . height ) ;
125- } catch ( ex ) {
126- console . log ( "exception: " + ex ) ;
127- }
128- }
129- //trace.write("| UIApplication.sharedApplication().statusBarHidden: " + UIApplication.sharedApplication().statusBarHidden, "LayoutRootView.iOS");
130- //trace.write("| statusBarHeight: " + statusBarHeight, "LayoutRootView.iOS");
131-
132- var origin = parentBounds . origin ;
133- var left = origin . x ;
134- var top = origin . y + statusBarHeight ;
135-
136- var widthSpec = layout . makeMeasureSpec ( width , common . layout . EXACTLY ) ;
137- var heightSpec = layout . makeMeasureSpec ( height - statusBarHeight , common . layout . EXACTLY ) ;
138-
139- //trace.write("| >>> Will measure and layout with {{" + left + ", " + top + "}{" + width + ", " + height + "}}", "LayoutRootView.iOS");
140- //trace.write("--------------------------------------------", "LayoutRootView.iOS");
141-
142- rootView . measure ( widthSpec , heightSpec ) ;
143- rootView . layout ( left , top , width , height ) ;
144- }
14570}
14671
14772export function GC ( ) {
0 commit comments