| | |
| | | using System.Drawing; |
| | | using Foundation; |
| | | using UIKit; |
| | | |
| | | using WebKit; |
| | | namespace HDL_ON_iOS |
| | | { |
| | | public class ViewControllerBase : Shared.BaseViewController |
| | |
| | | UIView activeView = KeyboardGetActiveView (); |
| | | if (activeView == null) |
| | | return; |
| | | string sss = activeView.ToString(); |
| | | if (sss.StartsWith("<WKContentView")) |
| | | return; |
| | | UIView scrollView = activeView.FindSuperviewOfType_Self (this.View, typeof (UIView)) as UIView; |
| | | if (scrollView == null) |
| | | return; |
| | |
| | | CoreGraphics.CGRect viewRectAboveKeyboard = new CoreGraphics.CGRect (this.View.Frame.Location, |
| | | new CoreGraphics.CGSize (this.View.Frame.Width, this.View.Frame.Size.Height - keyboardBounds.Size.Height)); |
| | | CoreGraphics.CGRect activeFieldAbsoluteFrame = activeView.Superview.ConvertRectToView (activeView.Frame, this.View); |
| | | if (!viewRectAboveKeyboard.Contains (activeFieldAbsoluteFrame)) { |
| | | if (!viewRectAboveKeyboard.Contains(activeFieldAbsoluteFrame)) |
| | | { |
| | | //PointF scrollPoint = new PointF (0.0f, |
| | | // (float)(activeFieldAbsoluteFrame.Location.Y + activeFieldAbsoluteFrame.Height |
| | | // + scrollView.ContentOffset.Y - viewRectAboveKeyboard.Height)); |
| | |
| | | { |
| | | UIView activeView = KeyboardGetActiveView (); |
| | | if (activeView == null) |
| | | return; |
| | | string sss = activeView.ToString(); |
| | | if (sss.StartsWith("<WKContentView")) |
| | | return; |
| | | UIView scrollView = activeView.FindSuperviewOfType_Self (this.View, typeof (UIView)) as UIView; |
| | | if (scrollView == null) |
| | |
| | | { |
| | | public static UIView FindFirstResponder (this UIView view) |
| | | { |
| | | if (view.IsFirstResponder) { |
| | | if (view.IsFirstResponder) |
| | | { |
| | | return view; |
| | | } |
| | | foreach (UIView subView in view.Subviews) { |
| | | foreach (UIView subView in view.Subviews) |
| | | { |
| | | var firstResponder = subView.FindFirstResponder (); |
| | | if (firstResponder != null) |
| | | return firstResponder; |
| | |
| | | } |
| | | public static UIView FindSuperviewOfType (this UIView view, UIView stopAt, Type type) |
| | | { |
| | | if (view.Superview != null) { |
| | | if (type.IsAssignableFrom (view.Superview.GetType ())) { |
| | | if (view.Superview != null) |
| | | { |
| | | if (type.IsAssignableFrom(view.Superview.GetType())) |
| | | { |
| | | return view.Superview; |
| | | } |
| | | if (view.Superview != stopAt) |
| | |
| | | |
| | | public static UIView FindSuperviewOfType_Self (this UIView view, UIView stopAt, Type type) |
| | | { |
| | | if (view.Superview != null) { |
| | | if (view.Superview != null) |
| | | { |
| | | return view.Superview.FindSuperviewOfType_Self (stopAt, type); |
| | | } |
| | | return view; |