protected override StandardContentCell CreateCell(UITableView tableView) { var cell = new StandardContentCell(UITableViewCellStyle.Default, Type); cell.SelectionStyle = UITableViewCellSelectionStyle.None; button = UIButton.FromType (UIButtonType.Custom); button.SetTitle (Text, UIControlState.Normal); button.Font = UIFont.BoldSystemFontOfSize (16); button.BackgroundColor = BackgroundColor; button.TitleEdgeInsets = new UIEdgeInsets(0, 6, 0, 6); button.Layer.CornerRadius = 7.0f; button.SetTitleColor(TextColor, UIControlState.Normal); button.SizeToFit (); button.TouchUpInside += delegate { RowSelectedImpl (tableView); }; if (Disable) { button.UserInteractionEnabled = false; button.Enabled = false; button.TitleLabel.Enabled = false; } float left = (tableView.Frame.Width - button.Frame.Width ) / 2 - 12; button.Frame = new RectangleF(left, 4, button.Frame.Width + 12, 36); cell.ContentView.Add (button); return cell; }
protected override void FixedCommon(UITableView tableView, StandardContentCell cell, NSIndexPath indexPath) { }
protected override StandardContentCell CreateCell(UITableView tableView) { var cell = new StandardContentCell(UITableViewCellStyle.Default, Type); cell.SelectionStyle = UITableViewCellSelectionStyle.None; var button1 = UIButton.FromType (UIButtonType.Custom); var button2 = UIButton.FromType (UIButtonType.Custom); button1.TitleLabel.LineBreakMode = UILineBreakMode.WordWrap; button2.TitleLabel.LineBreakMode = UILineBreakMode.WordWrap; button1.TitleLabel.TextAlignment = UITextAlignment.Center; button2.TitleLabel.TextAlignment = UITextAlignment.Center; button1.TitleLabel.Lines = 2; button2.TitleLabel.Lines = 2; button1.SetTitle (Button1Text, UIControlState.Normal); button1.Font = UIFont.BoldSystemFontOfSize (14); button1.BackgroundColor = BackgroundColor; button1.TitleEdgeInsets = new UIEdgeInsets(0, 6, 0, 6); button1.Layer.CornerRadius = 7.0f; button1.SetTitleColor(TextColor, UIControlState.Normal); button1.TouchUpInside += delegate { Button1Action(); }; button2.SetTitle (Button2Text, UIControlState.Normal); button2.Font = UIFont.BoldSystemFontOfSize (14); button2.BackgroundColor = BackgroundColor; button2.TitleEdgeInsets = new UIEdgeInsets(0, 6, 0, 6); button2.Layer.CornerRadius = 7.0f; button2.SetTitleColor(TextColor, UIControlState.Normal); button2.TouchUpInside += delegate { Button2Action(); }; button1.Frame = new RectangleF (0, 0, 120, 0); button2.Frame = new RectangleF (0, 0, 120, 0); const float spacingBetweenButtons = 16; float totalWidth = button1.Frame.Width + button2.Frame.Width + spacingBetweenButtons; float left = (tableView.Frame.Width - totalWidth) / 2; button1.Frame = new RectangleF(left, 4, button1.Frame.Width, 36); left += button1.Frame.Width + spacingBetweenButtons; button2.Frame = new RectangleF(left, 4, button2.Frame.Width, 36); cell.ContentView.Add (button1); cell.ContentView.Add (button2); return cell; }
protected override StandardContentCell CreateCell(UITableView tableView) { var cell = new StandardContentCell(UITableViewCellStyle.Default, Type); cell.SelectionStyle = UITableViewCellSelectionStyle.None; var backView = new UIView(); backView.BackgroundColor = UIColor.Clear; cell.BackgroundView = backView; button1 = UIButton.FromType (UIButtonType.RoundedRect); button1.SetTitle (Button1Text, UIControlState.Normal); button1.Font = UIFont.BoldSystemFontOfSize (14); button1.SizeToFit (); button1.TouchUpInside += delegate { Button1Action(); }; button2 = UIButton.FromType (UIButtonType.RoundedRect); button2.SetTitle (Button2Text, UIControlState.Normal); button2.Font = UIFont.BoldSystemFontOfSize (14); button2.SizeToFit (); button2.TouchUpInside += delegate { Button2Action(); }; const float spacingBetweenButtons = 16; float totalWidth = button1.Frame.Width + button2.Frame.Width + spacingBetweenButtons; float left = (tableView.Frame.Width - totalWidth) / 2; button1.Frame = new RectangleF(left, 4, button1.Frame.Width, 36); left += button1.Frame.Width + spacingBetweenButtons; button2.Frame = new RectangleF(left, 4, button2.Frame.Width, 36); cell.ContentView.Add (button1); cell.ContentView.Add (button2); return cell; }
private static void ApplyBackgroundColor(StandardContentCell cell, UIColor color) { var view = new UIView (); view.BackgroundColor = color; cell.BackgroundView = view; cell.TextLabel.BackgroundColor = UIColor.Clear; if (cell.DetailTextLabel != null) cell.DetailTextLabel.BackgroundColor = UIColor.Clear; }
protected virtual void FixedCommon(UITableView tableView, StandardContentCell cell, NSIndexPath indexPath) { if (cell.TextLabel != null) { cell.TextLabel.Font = _controller._headingFont; cell.TextLabel.Text = Text; } if (BackgroundColor != null) ApplyBackgroundColor (cell, BackgroundColor); else if (_controller.CellBackgroundColor != null) ApplyBackgroundColor (cell, _controller.CellBackgroundColor); if (TextColor != null) cell.TextLabel.TextColor = TextColor; else if (_controller.CellTextColor != null) cell.TextLabel.TextColor = _controller.CellTextColor; if (TextFont != null) cell.TextLabel.Font = TextFont; if (DetailsFont != null && cell.DetailTextLabel != null) cell.DetailTextLabel.Font = DetailsFont; if (cell.DetailTextLabel != null) { if (DetailsColor != null) cell.DetailTextLabel.TextColor = DetailsColor; else if (_controller.CellDetailsColor != null) cell.DetailTextLabel.TextColor = _controller.CellDetailsColor; } if (Accessory != null) cell.Accessory = Accessory.Value; else cell.Accessory = UITableViewCellAccessory.None; if (cell.DetailTextLabel != null) cell.DetailTextLabel.Text = Details; if (LoadingIndicatorAccessory) { var loading = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray); //loading.Frame = new RectangleF(tableView.Frame.Width - (_controller._rightOffset * 2) - Height, 0, Height, Height); loading.StartAnimating (); cell.AccessoryView = loading; } if (StaticImage != null) SetImage (cell, UIImage.FromFile (StaticImage)); else if (ImageGetter != null) SetImage (cell, ImageGetter ()); else SetImage (cell, null); if (AfterGetCellInit != null) AfterGetCellInit (cell); }