Пример #1
0
            public SplitButton(UIImage image, string text, Action touched = null)
                : base(UIButtonType.Custom)
            {
                AutosizesSubviews = true;

                _image = new UIImageView();
                _image.Image = image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                _image.TintColor = Theme.PrimaryNavigationBarColor;
                this.Add(_image);

                _text = new UILabel();
                _text.TextColor = DefaulTextColor;
                _text.Font = TextFont;
                _text.Text = text;
                _text.AdjustsFontSizeToFitWidth = true;
                _text.MinimumScaleFactor = 0.7f;
                this.Add(_text);

                if (touched != null)
                {
//                    this.TouchDown += (sender, e) => this.BackgroundColor = UIColor.FromWhiteAlpha(0.95f, 1.0f);
//                    this.TouchUpOutside += (sender, e) => this.BackgroundColor = UIColor.White;
//
                    this.TouchUpInside += (sender, e) => 
                    {
//                        this.BackgroundColor = UIColor.White;
                        touched();
                    };
                }
            }