public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); // Hide keyboard when user taps on the View background _gesture = View.DismissKeyboardOnTap(); _autoScrollHelper = new AutoScrollHelper(this); for (var i = 0; i < _contentView.Subviews.Count(); i++) { var textField = _contentView.Subviews[i] as UITextField; if (textField != null) { textField.Tag = i; textField.ShouldReturn = ShouldReturn; } } }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); _gesture.Dispose(); _gesture = null; _autoScrollHelper.Dispose(); _autoScrollHelper = null; for (var i = 0; i < _contentView.Subviews.Count(); i++) { var textField = _contentView.Subviews[i] as UITextField; if (textField != null) { textField.ShouldReturn = null; } } }