Пример #1
0
        public void showPopup()
        {
            if (this.popup == null)
            {
                this.Layer.ZPosition = 1000;
                var popup = new KeyboardKeyBackground(cornerRadius: 9.0f, underOffset: this.underOffset);
                this.popup = popup;
                this.AddSubview(popup);

                var _popupLabel = new UILabel();

                _popupLabel.TextAlignment      = this.label.TextAlignment;
                _popupLabel.BaselineAdjustment = this.label.BaselineAdjustment;
                _popupLabel.Font = this.label.Font.WithSize(22 * 2);
                _popupLabel.AdjustsFontSizeToFitWidth = this.label.AdjustsFontSizeToFitWidth;
                _popupLabel.MinimumScaleFactor        = (CGFloat)(0.1);
                _popupLabel.UserInteractionEnabled    = false;
                _popupLabel.Lines = 1;
                _popupLabel.Frame = popup.Bounds;
                _popupLabel.Text  = this.label.Text;
                popup.AddSubview(_popupLabel);
                this.popupLabel = _popupLabel;

                this.label.Hidden = true;
            }
        }
Пример #2
0
        public void hidePopup()
        {
            if (this.popup != null)
            {
                this.delegate_.willHidePopup(this);
                if (this.popupLabel != null)
                {
                    this.popupLabel.RemoveFromSuperview();
                }
                if (this.popupLabel != null)
                {
                    this.popupLabel = null;
                }
                this.connector.RemoveFromSuperview();
                this.connector = null;
                this.popup.RemoveFromSuperview();
                this.popup = null;

                this.label.Hidden = false;
                this.background.attach(null);
                this.Layer.ZPosition = 0;

                this.popupDirection = null;
            }
        }
Пример #3
0
        public KeyboardKey(VibrancyType optionalVibrancy) :
            base(CGRect.Empty)
        {
            this.vibrancy = optionalVibrancy;

            this.displayView = new ShapeView();
            this.underView   = new ShapeView();
            this.borderView  = new ShapeView();

            this.shadowLayer = new CAShapeLayer();
            this.shadowView  = new UIView();

            this.label = new UILabel();
            this.text  = "";

            this.color       = UIColor.White;
            this.underColor  = UIColor.Gray;
            this.borderColor = UIColor.Black;
            this.popupColor  = UIColor.White;
            this.drawUnder   = true;
            this.drawOver    = true;
            this.drawBorder  = false;
            this.underOffset = 1;

            this.background     = new KeyboardKeyBackground(cornerRadius: 4, underOffset: this.underOffset);
            this.textColor      = UIColor.Black;
            this.popupDirection = null;


            this.AddSubview(this.shadowView);
            this.shadowView.Layer.AddSublayer(this.shadowLayer);
            this.AddSubview(this.displayView);

            var underView = this.underView;

            if (underView != null)
            {
                this.AddSubview(underView);
            }

            var borderView = this.borderView;

            if (borderView != null)
            {
                this.AddSubview(borderView);
            }

            this.AddSubview(this.background);

            this.background.AddSubview(this.label);


            //var setupViews: Void = {
            this.displayView.Opaque = false;
            this.underView.Opaque   = false;
            this.borderView.Opaque  = false;


            this.shadowLayer.ShadowOpacity = 0.2f;
            this.shadowLayer.ShadowRadius  = 4;
            this.shadowLayer.ShadowOffset  = new CGSize(0, 3);


            this.borderView.lineWidth = (CGFloat)(0.5);
            this.borderView.fillColor = UIColor.Clear;


            this.label.TextAlignment      = UITextAlignment.Center;
            this.label.BaselineAdjustment = UIBaselineAdjustment.AlignCenters;
            this.label.Font = this.label.Font.WithSize(22);
            this.label.AdjustsFontSizeToFitWidth = true;
            this.label.MinimumScaleFactor        = (CGFloat)(0.1);
            this.label.UserInteractionEnabled    = false;
            this.label.Lines = 1;
        }