Files
Hristo Hristov 0f14101238 recycling now happens only if nativeView and android properties are not accessed. (#4627)
recycleNativeView filed now accepts: "always" | "never" | "auto". Always will recycle the nativeView no matter if its nativeView or android proprties are accessed. Never will disable recycling. Auto will recycle it only if nativeView and android properties are not accessed.
2017-08-01 15:04:16 +03:00

51 lines
1.6 KiB
TypeScript

import { View } from "./core/view";
import * as utils from "../utils/utils";
import getter = utils.ios.getter;
export module ios {
export function getActualHeight(view: UIView): number {
if (view.window && !view.hidden) {
return view.frame.size.height;
}
return 0;
}
export function getStatusBarHeight(): number {
var app = getter(UIApplication, UIApplication.sharedApplication);
if (!app || app.statusBarHidden) {
return 0;
}
var statusFrame = app.statusBarFrame;
let min = Math.min(statusFrame.size.width, statusFrame.size.height);
return utils.layout.toDevicePixels(min);
}
export function _layoutRootView(rootView: View, parentBounds: CGRect) {
if (!rootView || !parentBounds) {
return;
}
let size = parentBounds.size;
let width = utils.layout.toDevicePixels(size.width);
let height = utils.layout.toDevicePixels(size.height);
var superview = (<UIView>rootView.nativeViewProtected).superview;
var superViewRotationRadians;
if (superview) {
superViewRotationRadians = atan2f(superview.transform.b, superview.transform.a);
}
var origin = parentBounds.origin;
var left = origin.x;
var top = origin.y;
var widthSpec = utils.layout.makeMeasureSpec(width, utils.layout.EXACTLY);
var heightSpec = utils.layout.makeMeasureSpec(height, utils.layout.EXACTLY);
rootView.measure(widthSpec, heightSpec);
rootView.layout(left, top, width, height);
}
}