void HandleColorButtonTouchUpInside(object sender, EventArgs e) { if (colorPicker == null) { colorPicker = new ColorPickerBar(new CGRect(backgroundView.Frame.Right, colorButton.Frame.Y - ((83f - colorButton.Frame.Height) / 2f), 180, 83), highlighterMode); colorPicker.ColorSelectedEvent += HandleColorSelectedEvent; this.AddSubview(colorPicker); ShowColorPickerBar(); } else { HideColorPickerBar(true); } }
private void HideColorPickerBar(bool updateFrame) { colorButton.Selected = false; if (colorPicker != null) { colorPicker.Transform = CGAffineTransform.MakeIdentity(); UIView.Animate(0.2d, 0d, UIViewAnimationOptions.CurveEaseOut, delegate { colorPicker.Transform = CGAffineTransform.MakeScale(0.01f, 0.01f); }, delegate { if (updateFrame) { UpdateFrame(new CGRect(this.Frame.X, this.Frame.Y, backgroundView.Frame.Right, this.Frame.Height)); } colorPicker.RemoveFromSuperview(); colorPicker.Dispose(); colorPicker = null; }); } }