public override UITableViewCell GetCell(UITableView tv) { var cell = tv.DequeueReusableCell (ekey); if (cell == null){ cell = new MultiLineTableCell (UITableViewCellStyle.Subtitle, ekey); cell.SelectionStyle = UITableViewCellSelectionStyle.None; } else RemoveTag (cell, 1); if (entry == null) { entry = new UITextView(new RectangleF(0, 28, cell.ContentView.Bounds.Width, 16 + (20 * (Rows + 1)))); entry.Font = UIFont.SystemFontOfSize(16); entry.Text = Value ?? ""; entry.BackgroundColor = UIColor.Clear; entry.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleLeftMargin; entry.Ended += delegate { Value = entry.Text; entry.ResignFirstResponder(); }; entry.Changed += delegate(object sender, EventArgs e) { if(!string.IsNullOrEmpty(entry.Text)) { int i = entry.Text.IndexOf("\n", entry.Text.Length -1); if (i > -1) { entry.Text = entry.Text.Substring(0,entry.Text.Length -1); entry.ResignFirstResponder(); } } Value = entry.Text; }; //////////////// // entry.Started += delegate { // MultiLineEntryElement focus = null; // foreach (var e in (Parent as Section).Elements){ // if (e == this) // focus = this; // else if (focus != null && e is MultiLineEntryElement) // focus = e as MultiLineEntryElement; // } // if (focus != this) // focus.entry.BecomeFirstResponder (); // else // focus.entry.ResignFirstResponder (); // // }; // entry.Started += delegate { // MultiLineEntryElement self = null; // var returnType = UIReturnKeyType.Default; // // foreach (var e in (Parent as Section).Elements){ // if (e == this) // self = this; // else if (self != null && e is MultiLineEntryElement) // returnType = UIReturnKeyType.Next; // } // }; entry.ReturnKeyType = UIReturnKeyType.Done; } /////////// cell.TextLabel.Text = Caption; cell.ContentView.AddSubview (entry); return cell; }
public override UITableViewCell GetCell(UITableView tv) { var cell = tv.DequeueReusableCell(ekey); if (cell == null) { cell = new MultiLineTableCell(UITableViewCellStyle.Subtitle, ekey); cell.SelectionStyle = UITableViewCellSelectionStyle.None; } else { RemoveTag(cell, 1); } if (entry == null) { entry = new UITextView(new RectangleF(0, 28, cell.ContentView.Bounds.Width, 16 + (20 * (Rows + 1)))); entry.Font = UIFont.SystemFontOfSize(16); entry.Text = Value ?? ""; entry.BackgroundColor = UIColor.Clear; entry.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleLeftMargin; entry.Ended += delegate { Value = entry.Text; entry.ResignFirstResponder(); }; entry.Changed += delegate(object sender, EventArgs e) { if (!string.IsNullOrEmpty(entry.Text)) { int i = entry.Text.IndexOf("\n", entry.Text.Length - 1); if (i > -1) { entry.Text = entry.Text.Substring(0, entry.Text.Length - 1); entry.ResignFirstResponder(); } } Value = entry.Text; }; //////////////// // entry.Started += delegate { // MultiLineEntryElement focus = null; // foreach (var e in (Parent as Section).Elements){ // if (e == this) // focus = this; // else if (focus != null && e is MultiLineEntryElement) // focus = e as MultiLineEntryElement; // } // if (focus != this) // focus.entry.BecomeFirstResponder (); // else // focus.entry.ResignFirstResponder (); // // }; // entry.Started += delegate { // MultiLineEntryElement self = null; // var returnType = UIReturnKeyType.Default; // // foreach (var e in (Parent as Section).Elements){ // if (e == this) // self = this; // else if (self != null && e is MultiLineEntryElement) // returnType = UIReturnKeyType.Next; // } // }; entry.ReturnKeyType = UIReturnKeyType.Done; } /////////// cell.TextLabel.Text = Caption; cell.ContentView.AddSubview(entry); return(cell); }