Patch for IQKeyboardManager issue.

This commit is contained in:
Rossen Hristov
2015-11-05 14:46:35 +02:00
parent ca729e4ce0
commit dec5d971f3
3 changed files with 23 additions and 8 deletions

1
ui/core/view.d.ts vendored
View File

@@ -502,6 +502,7 @@ declare module "ui/core/view" {
_goToVisualState(state: string);
_nativeView: any;
_isVisible: boolean;
_setNativeViewFrame(nativeView: UIView, frame: CGRect): void;
//@endprivate
}

View File

@@ -232,13 +232,20 @@ export class View extends viewCommon.View {
//
}
public _setNativeViewFrame(nativeView: UIView, frame: CGRect) {
if (!CGRectEqualToRect(nativeView.frame, frame)) {
trace.write(this + ", Native setFrame: = " + NSStringFromCGRect(frame), trace.categories.Layout);
nativeView.frame = frame;
var boundsOrigin = nativeView.bounds.origin;
nativeView.bounds = CGRectMake(boundsOrigin.x, boundsOrigin.y, frame.size.width, frame.size.height);
}
}
public layoutNativeView(left: number, top: number, right: number, bottom: number): void {
if (!this._nativeView) {
return;
}
var frame = CGRectMake(left, top, right - left, bottom - top);
// This is done because when rotated in iOS7 there is rotation applied on the first subview on the Window which is our frame.nativeView.view.
// If we set it it should be transformed so it is correct.
// When in landscape in iOS 7 there is transformation on the first subview of the window so we set frame to its subview.
@@ -252,12 +259,8 @@ export class View extends viewCommon.View {
nativeView = this._nativeView;
}
if (!CGRectEqualToRect(nativeView.frame, frame)) {
trace.write(this + ", Native setFrame: = " + NSStringFromCGRect(frame), trace.categories.Layout);
nativeView.frame = frame;
var boundsOrigin = nativeView.bounds.origin;
nativeView.bounds = CGRectMake(boundsOrigin.x, boundsOrigin.y, frame.size.width, frame.size.height);
}
var frame = CGRectMake(left, top, right - left, bottom - top);
this._setNativeViewFrame(nativeView, frame);
}
public _updateLayout() {