public override UITableViewCell GetCell(UITableView tv) { var cell = tv.DequeueReusableCell(CustomInputCell.Key) as CustomInputCell; if (cell == null) { cell = new CustomInputCell(); cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.TextView.Ended += delegate { Value = cell.TextView.Text; }; cell.TextView.Changed += (s, e) => { Value = cell.TextView.Text; var height = (int)cell.Bounds.Height; var newHeight = (int)GetHeight(GetRootElement().TableView, this.IndexPath); Console.WriteLine("{0} vs {1}", height, newHeight); if (newHeight != height) { GetRootElement().TableView.BeginUpdates(); GetRootElement().TableView.EndUpdates(); } //cell.TextView.GetCaretRectForPosition(cell.TextView.SelectedTextRange.start); cell.TextView.ScrollRangeToVisible(cell.TextView.SelectedRange); }; cell.TextView.ReturnKeyType = UIReturnKeyType.Done; } cell.TextView.Text = Value ?? string.Empty; return(cell); }
public override UITableViewCell GetCell(UITableView tv) { var cell = tv.DequeueReusableCell(CustomInputCell.Key) as CustomInputCell; if (cell == null) { cell = new CustomInputCell(_postImageFunc(), _description); cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.TextView.Ended += delegate { Value = cell.TextView.Text; }; cell.TextView.Changed += (s, e) => { Value = cell.TextView.Text; tv.BeginUpdates(); tv.EndUpdates(); var caret = cell.TextView.GetCaretRectForPosition(cell.TextView.SelectedTextRange.Start); var cursorRect = tv.ConvertRectFromView(caret, cell.TextView); var kk = cursorRect.Size; kk.Height += 8.0f; cursorRect.Size = kk; tv.ScrollRectToVisible(cursorRect, false); }; //cell.TextView.ReturnKeyType = UIReturnKeyType.Done; } cell.TextView.Text = Value ?? string.Empty; return(cell); }
public override UITableViewCell GetCell(UITableView tv) { var cell = tv.DequeueReusableCell(CellKey) as CustomInputCell; if (cell == null) { cell = new CustomInputCell(); cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.TextView.Ended += delegate { Value = cell.TextView.Text; }; cell.TextView.Changed += (s, e) => { Value = cell.TextView.Text; var height = (int)cell.Bounds.Height; var newHeight = (int)GetHeight(GetImmediateRootElement().TableView, this.IndexPath); Console.WriteLine("{0} vs {1}", height, newHeight); if (newHeight != height) { GetImmediateRootElement().TableView.BeginUpdates(); GetImmediateRootElement().TableView.EndUpdates(); } //cell.TextView.GetCaretRectForPosition(cell.TextView.SelectedTextRange.start); cell.TextView.ScrollRangeToVisible(cell.TextView.SelectedRange); }; cell.TextView.ReturnKeyType = UIReturnKeyType.Done; } cell.TextView.Text = Value ?? string.Empty; return cell; }
public override UITableViewCell GetCell(UITableView tv) { var cell = tv.DequeueReusableCell(CustomInputCell.Key) as CustomInputCell; if (cell == null) { cell = new CustomInputCell(_description); cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.TextView.Font = Font; cell.TextView.InputAccessoryView = AccessoryView != null?AccessoryView(cell.TextView) : new UIView(); cell.TextView.AutocorrectionType = SpellChecking ? UITextAutocorrectionType.Default : UITextAutocorrectionType.No; cell.TextView.SpellCheckingType = SpellChecking ? UITextSpellCheckingType.Default : UITextSpellCheckingType.No; cell.TextView.AutocapitalizationType = SpellChecking ? UITextAutocapitalizationType.Sentences : UITextAutocapitalizationType.None; } cell.HiddenSeperator = HiddenSeperator; if (_textEditEnded != null) { _textEditEnded.Dispose(); } _textEditEnded = Observable.FromEventPattern(x => cell.TextView.Ended += x, x => cell.TextView.Ended -= x) .Subscribe(x => Value = cell.TextView.Text); if (_textEditChanged != null) { _textEditChanged.Dispose(); } _textEditChanged = Observable.FromEventPattern(x => cell.TextView.Changed += x, x => cell.TextView.Changed -= x) .Subscribe(x => { Value = cell.TextView.Text; tv.BeginUpdates(); tv.EndUpdates(); var caret = cell.TextView.GetCaretRectForPosition(cell.TextView.SelectedTextRange.Start); var cursorRect = tv.ConvertRectFromView(caret, cell.TextView); var kk = cursorRect.Size; kk.Height += 8.0f; cursorRect.Size = kk; tv.ScrollRectToVisible(cursorRect, false); }); cell.TextView.Text = Value ?? string.Empty; return(cell); }
public override UITableViewCell GetCell(UITableView tv) { var cell = tv.DequeueReusableCell(CustomInputCell.Key) as CustomInputCell; if (cell == null) { cell = new CustomInputCell(_description); cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.TextView.Font = Font; cell.TextView.InputAccessoryView = AccessoryView != null ? AccessoryView(cell.TextView) : new UIView(); cell.TextView.AutocorrectionType = SpellChecking ? UITextAutocorrectionType.Default : UITextAutocorrectionType.No; cell.TextView.SpellCheckingType = SpellChecking ? UITextSpellCheckingType.Default : UITextSpellCheckingType.No; cell.TextView.AutocapitalizationType = SpellChecking ? UITextAutocapitalizationType.Sentences : UITextAutocapitalizationType.None; } cell.HiddenSeperator = HiddenSeperator; if (_textEditEnded != null) _textEditEnded.Dispose(); _textEditEnded = Observable.FromEventPattern(x => cell.TextView.Ended += x, x => cell.TextView.Ended -= x) .Subscribe(x => Value = cell.TextView.Text); if (_textEditChanged != null) _textEditChanged.Dispose(); _textEditChanged = Observable.FromEventPattern(x => cell.TextView.Changed += x, x => cell.TextView.Changed -= x) .Subscribe(x => { Value = cell.TextView.Text; tv.BeginUpdates(); tv.EndUpdates(); var caret = cell.TextView.GetCaretRectForPosition(cell.TextView.SelectedTextRange.Start); var cursorRect = tv.ConvertRectFromView(caret, cell.TextView); var kk = cursorRect.Size; kk.Height += 8.0f; cursorRect.Size = kk; tv.ScrollRectToVisible(cursorRect, false); }); cell.TextView.Text = Value ?? string.Empty; return cell; }