Files
Hristo Hristov af034089ca iOS Frame, Page and TabView measure/layout methods removed. We now rely on the framework positioning. This will result in a change that width, height, minWidth, minHeight, margins not respected on these controls
iOS layout positioning now respects native properties like automaticallyAdjustsScrollViewInsets, edgesForExtendedLayout, extendedLayoutIncludesOpaqueBars, navigationBar.translucent, tabBar.translucent
Removed frame-tests.ios.ts - those tests are now invalid
Added new layout tests inside page-tests.ios.ts
Commented few asserts in scroll-view-tests
View now expose ios namespace with layoutView method and UILayoutViewController used by page, tab-view and application module
ViewBase now expose viewController property that should be set from all widgets that are using viewcontrollers internally (like Page, Frame, TabView)
ViewBase now sets ios property to either the view returned from createNativeView or to nativeViewProptected
fragment.transitions now use animation/transition start to add fragments to waitingQueue. Before we did it manually in navigate/goBack. This way we can reuse the fragment.transition when calling showDialog. Also when animation/transition ends we check the animation/transition to see if this fragment should be set as current.
Frame expose new loadViewFromEntry method (to load a view from URI)
Frame navigation happens once frame is loaded
Frame now supports Page as a child in XML
Fixed GridLayout row, rowSpan, column, columnSpan properties type
Fixed bug in GridLayout where add/remove of columns/rows won't update the internal state of the grid (backport from android when GridLayout is recycled)
ListView will no longer invalidate layout when cell is removed
Fixed bug in ScrollView ios where effectiveMinWidth/Height was multiplied to density (it is already on device pixels so no need to multiply)
TabView android now calls loaded only on the selected child (not all)
Core refactoring
2017-12-15 13:06:34 +02:00

49 lines
1.5 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 utils.layout.toDevicePixels(view.frame.size.height);
}
return 0;
}
export function getStatusBarHeight(viewController?: UIViewController): number {
const app = getter(UIApplication, UIApplication.sharedApplication);
if (!app || app.statusBarHidden) {
return 0;
}
if (viewController && viewController.prefersStatusBarHidden) {
return 0;
}
const statusFrame = app.statusBarFrame;
const 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;
}
const size = parentBounds.size;
const width = utils.layout.toDevicePixels(size.width);
const height = utils.layout.toDevicePixels(size.height);
const widthSpec = utils.layout.makeMeasureSpec(width, utils.layout.EXACTLY);
const heightSpec = utils.layout.makeMeasureSpec(height, utils.layout.EXACTLY);
rootView.measure(widthSpec, heightSpec);
const origin = parentBounds.origin;
const left = origin.x;
const top = origin.y;
rootView.layout(left, top, width, height);
}
}