void Ok_Click(object sender, EventArgs e) { editor.Crop(); visibilityLayout.Visibility = ViewStates.Gone; }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); presentController = GetVisibleViewController(); sfImageEditor = new SfImageEditor(new CGRect(View.Frame.Location.X, 60, View.Frame.Size.Width, View.Frame.Size.Height - 60)); sfImageEditor.ToolBarSettings.ToolbarItems.Clear(); sfImageEditor.ToolBarSettings.ToolbarItems.Add(new FooterToolbarItem() { Text = "Banner Types", SubItems = new System.Collections.Generic.List <ToolbarItem>() { new ToolbarItem() { Text = "Facebook Post" }, new ToolbarItem() { Text = "Facebook Cover" }, new ToolbarItem() { Text = "Twitter Cover" }, new ToolbarItem() { Text = "Twitter Post" }, new ToolbarItem() { Text = "YouTubeChannel Cover" } } }); sfImageEditor.ToolBarSettings.ToolbarItems.Add(new CustomHeader() { HeaderName = "Share", Icon = UIImage.FromBundle("Images/ImageEditor/share.png") }); sfImageEditor.ToolBarSettings.ToolbarItemSelected += ToolbarItemSelected; sfImageEditor.ImageSaved += ImageEditor_ImageSaved; sfImageEditor.Image = _image; this.View.AddSubview(sfImageEditor); CropSelectionMenu = new UIView(new CGRect(0, 60, View.Frame.Width, 50)); CropSelectionMenu.BackgroundColor = UIColor.White; UIButton okButton = new UIButton(new CGRect(0, 0, View.Frame.Width / 2, 50)); okButton.SetTitle("OK", UIControlState.Normal); okButton.SetTitleColor(UIColor.Black, UIControlState.Normal); okButton.TouchDown += (sender, e) => { sfImageEditor.Crop(); CropSelectionMenu.Hidden = true; }; CropSelectionMenu.AddSubview(okButton); UIButton cancelButton = new UIButton(new CGRect(View.Frame.Width / 2, 0, View.Frame.Width / 2, 50)); cancelButton.SetTitle("Cancel", UIControlState.Normal); cancelButton.SetTitleColor(UIColor.Black, UIControlState.Normal); cancelButton.TouchDown += (sender, e) => { sfImageEditor.ToggleCropping(); CropSelectionMenu.Hidden = true; }; CropSelectionMenu.Hidden = true; CropSelectionMenu.AddSubview(cancelButton); View.AddSubview(CropSelectionMenu); }