Example #1
0
        public override void LayoutSubviews()
        {
            ExceptionUtility.Try(() =>
            {
                base.LayoutSubviews();

                if (!_setStyleFlag)
                {
                    _setStyleFlag = true;

                    if (this.AquamonixStyle == AquamonixButtonStyle.RoundedSolidColor)
                    {
                        if (this._disabledImage == null)
                        {
                            this._disabledImage = GraphicsUtility.CreateColoredRect(UIColor.Gray, this.Frame.Size);

                            if (this._disabledImage != null)
                            {
                                this.SetBackgroundImage(this._disabledImage, UIControlState.Disabled);
                            }
                        }

                        if (this._normalImage == null)
                        {
                            this._normalImage = GraphicsUtility.CreateColoredRect(this.BackgroundColor, this.Frame.Size);

                            if (this._normalImage != null)
                            {
                                this.SetBackgroundImage(this._normalImage, UIControlState.Normal);
                            }
                        }

                        this.MakeRoundedCorners(UIRectCorner.AllCorners, 20);
                        this.SetTitleColor(UIColor.White, UIControlState.Normal);
                        this.SetTitleColor(UIColor.White, UIControlState.Disabled);
                    }
                    else if (this.AquamonixStyle == AquamonixButtonStyle.Prev)
                    {
                        this.SetBackgroundImage(_prevButtonImage, UIControlState.Normal);
                        this.SizeToFit();
                        this.SetTitleColor(UIColor.White, UIControlState.Normal);
                    }
                    else if (this.AquamonixStyle == AquamonixButtonStyle.Next)
                    {
                        this.SetBackgroundImage(_nextButtonImage, UIControlState.Normal);
                        this.SizeToFit();
                        this.SetTitleColor(UIColor.White, UIControlState.Normal);
                    }
                }
            });
        }