public ModalFrameController(UIViewController contentViewController, Action doneTapped) { DoneAction = doneTapped; View = new UIView(); _toolbar = new UIToolbar(); View.AddSubviewDockBottom(_toolbar); _toolbar.SetItems( new UIBarButtonItem[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => _doneAction()) }, false ); _toolbar.BarStyle = UIBarStyle.Default; _toolbar.TintAdjustmentMode = UIViewTintAdjustmentMode.Normal; _contentView = new UIView(); //_contentView.BackgroundColor = UIColor.White; this.View.AddSubviewDock( _contentView, leftTarget: DockTarget.ToContainer(), topTarget: DockTarget.ToContainer(), rightTarget: DockTarget.ToContainer(), bottomTarget: DockTarget.ToView(_toolbar) ); ContentViewController = contentViewController; }
public MenuCell(CGRect frame) : base(frame) { this.BackgroundColor = UIColor.Clear; BackgroundView = new UIView { BackgroundColor = UIColor.Clear }; //SelectedBackgroundView = new UIView { BackgroundColor = UIColor.Red }; //this.Layer.BorderColor = UIColor.Brown.CGColor; //this.Layer.BorderWidth = 1; ContentView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; ContentView.Frame = ContentView.Bounds; //ContentView.Layer.BorderColor = UIColor.LightGray.CGColor; //ContentView.Layer.BorderWidth = 1.0f; ContentView.BackgroundColor = UIColor.Clear; //ContentView.Layer.CornerRadius = 5.0f; ContentView.Layer.MasksToBounds = true; _imageView = new UIImageView(/*UIImage.FromBundle("placeholder.png")*/); _imageView.Bounds = ContentView.Bounds; _imageView.Center = ContentView.Center; _imageView.ContentMode = UIViewContentMode.ScaleAspectFit; var imageContainerView = new UIView(); imageContainerView.AddSubviewDockFull(_imageView, new UIEdgeInsets(5, 5, 5, 5)); imageContainerView.BackgroundColor = UIColor.Clear; imageContainerView.Layer.BorderWidth = 2.0f; imageContainerView.Layer.BorderColor = this.TintColor.CGColor; imageContainerView.Layer.CornerRadius = 10.0f; ContentView.AddSubviewDock(imageContainerView, new UIEdgeInsets(0, 0, 0, 0), DockTarget.ToContainer(), DockTarget.ToContainer(), DockTarget.ToFixedLength(ImageWidthHeight), DockTarget.ToFixedLength(ImageWidthHeight /*+20*/)); // create label _labelView = new UILabel(ContentView.Bounds); _labelView.TextColor = UIColor.Black; _labelView.BackgroundColor = UIColor.Clear; _labelView.Text = "SiteName"; _labelView.Font = _labelView.Font.WithSize(10); _labelView.Lines = 2; _labelView.TextAlignment = UITextAlignment.Center; //_labelView.Layer.BorderWidth = 1; //_labelView.Layer.BorderColor = UIColor.Black.CGColor; ContentView.AddSubviewDock(_labelView, new UIEdgeInsets(3, 0, 0, 0), leftTarget: DockTarget.ToContainer(), topTarget: DockTarget.ToView(imageContainerView), rightTarget: DockTarget.ToContainer()); }