/// <summary> /// PickerView Must have non-empty frame /// </summary> public NativePickerContainer(UIView targetView, UIView pickerView, PickerBase owner) : base() { this.owner = owner; this.targetView = targetView; this.pickerView = pickerView; var scroll = new UIScrollView(this.View.Frame); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) { scroll.AddSubview(new UIToolbar(this.View.Frame) { AutoresizingMask = UIViewAutoresizing.FlexibleDimensions }); } scroll.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; scroll.AddSubview(this.pickerView); this.View.AddSubview(scroll); this.navigation = new UINavigationController(this); int navBarVisibilityFactor = this.owner.HideSystemButtons ? 0 : 1; this.navigation.NavigationBarHidden = this.owner.HideSystemButtons; this.navigation.View.Frame = new CGRect(0, 0, this.pickerView.Frame.Width, this.pickerView.Frame.Height + navBarVisibilityFactor * this.navigation.NavigationBar.Frame.Height); this.navigationSize = this.navigation.View.Frame.Size; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { this.popover = new UIPopoverController(this.navigation); this.popover.PopoverContentSize = this.navigation.View.Frame.Size; } else { this.fadeView.AddSubview(this.navigation.View); } this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(owner.OkButtonTitle, UIBarButtonItemStyle.Done, (s, e) => { this.Hide(true); if (this.DoneButtonAction != null) { this.DoneButtonAction(); } }); this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(owner.CancelButtonTitle, UIBarButtonItemStyle.Bordered, (s, e) => { this.Hide(true); }); }
public PickerDialogFragment(View pickerView, PickerBase owner) : base() { this.pickerView = pickerView; this.owner = owner; }