public override void LayoutSubviews()
        {
            base.LayoutSubviews();

            _titleLabel.SizeToFit();
            _subTitleLabel.SizeToFit();

            _container.Frame     = new CGRect(0f, (Bounds.Height - 50f) / 2f, Bounds.Width, _titleLabel.Frame.Height + _subTitleLabel.Frame.Height);
            _titleLabel.Frame    = new CGRect(5f, 5f, _container.Frame.Width - 10f, _titleLabel.Frame.Height);
            _subTitleLabel.Frame = new CGRect(5f, _titleLabel.Frame.Bottom, _container.Frame.Width - 10f, _subTitleLabel.Frame.Height);

            var padding = new UIEdgeInsets(RingPadding, RingPadding, RingPadding, RingPadding);

            _backgroundRingLayer.Path = UIBezierPath.FromOval(padding.InsetRect(Bounds)).CGPath;

            if (Progress > 0 && Max > 0)
            {
                _ringLayer.Path = UIBezierPath.FromArc(new CGPoint(Bounds.Size.Width / 2f,
                                                                   Bounds.Size.Height / 2f), Bounds.Height / 2f - RingWidth - RingPadding + RingWidth,
                                                       (nfloat)(-Math.PI / 2f),
                                                       (nfloat)((Math.PI * 2f * Progress / Max) - (Math.PI / 2f)), true).CGPath;
            }
            else
            {
                _ringLayer.Path = null;
            }
        }
        public override bool BeginTracking(UITouch uitouch, UIEvent uievent)
        {
            var touchPoint = uitouch.LocationInView(this);


            //Check both buttons upper and lower thumb handles because
            //they could be on top of each other.

            if (_lowerTouchEdgeInsets.InsetRect(_lowerHandle.Frame).Contains(touchPoint) && !LowerHandleHidden)
            {
                _lowerHandle.Highlighted = true;
                _lowerTouchOffset        = (float)touchPoint.X - (float)_lowerHandle.Center.X;
            }

            if (_upperTouchEdgeInsets.InsetRect(_upperHandle.Frame).Contains(touchPoint) && !UpperHandleHidden)
            {
                _upperHandle.Highlighted = true;
                _upperTouchOffset        = (float)touchPoint.X - (float)_upperHandle.Center.X;
            }

            _stepValueInternal = StepValueContinuously ? StepValue : 0.0f;

            DragStarted?.Invoke(this, EventArgs.Empty);

            return(true);
        }
예제 #3
0
        public override void DrawText(CGRect rect)
        {
            UIEdgeInsets insets = new UIEdgeInsets(0, 10, 0, 10);

            base.DrawText(insets.InsetRect(rect));
            //[super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)];
        }
예제 #4
0
        public static void AddContentChildViewController(this UIViewController parent, UIViewController contentViewController, UIEdgeInsets edgeInsets)
        {
            var view = parent.View;

            view.Add(contentViewController.View);
            contentViewController.View.Frame            = edgeInsets.InsetRect(view.Frame);
            contentViewController.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            contentViewController.DidMoveToParentViewController(parent);
        }
예제 #5
0
        public override CGRect TextRect(CGRect forBounds)
        {
            var insets = new UIEdgeInsets(
                (float)Padding.Top,
                (float)Padding.Left,
                (float)Padding.Bottom,
                (float)Padding.Right);

            return(insets.InsetRect(forBounds));
        }
예제 #6
0
        public void InsetRect()
        {
            var i = new UIEdgeInsets(10, 20, 30, 40);
            var r = new RectangleF(1, 2, 3, 4);

            r = i.InsetRect(r);
            Assert.That(r.X, Is.EqualTo((nfloat)21f), "X");
            Assert.That(r.Y, Is.EqualTo((nfloat)12f), "Y");
            Assert.That(r.Width, Is.EqualTo((nfloat)(-57f)), "Width");
            Assert.That(r.Height, Is.EqualTo((nfloat)(-36f)), "Height");

            Assert.False(i.Equals(UIEdgeInsets.Zero), "Equals(UIEdgeInsets)");
            Assert.False(UIEdgeInsets.Zero.Equals((object)i), "Equals(object)");
        }
예제 #7
0
        public override void DrawText(CGRect rect)
        {
            Layer.CornerRadius = rect.Height / 2;
            var insetsWithBorder = ActualInsetsWithBorder();
            var insets           = new UIEdgeInsets(
                top: insetsWithBorder.Height,
                left: insetsWithBorder.Width,
                bottom: insetsWithBorder.Height,
                right: insetsWithBorder.Width);

            var rectWithoutInsets = insets.InsetRect(rect);

            base.DrawText(rectWithoutInsets);
        }
예제 #8
0
        private void LayoutBackgroundImage()
        {
            var inset = new UIEdgeInsets((System.nfloat)Math.Min(0, shadowOffset.Height - shadowBlur),
                                         (System.nfloat)Math.Min(0, shadowOffset.Width - shadowBlur),
                                         (System.nfloat)(Math.Max(0, shadowOffset.Height + shadowBlur) * -1),
                                         (System.nfloat)(Math.Max(0, shadowOffset.Width + shadowBlur) * -1));

            backgroundImageView.Frame = inset.InsetRect(Bounds);
            backgroundImageView.Image = new UIGraphicsImageRenderer(this.Bounds.Size).CreateImage((ctx) =>
            {
                if (shadowColor != null)
                {
                    ctx.CGContext.SetShadow(shadowOffset, shadowBlur, shadowColor.CGColor);
                }

                contentViewColor.SetFill();
                var insetX = new UIEdgeInsets(inset.Top * -1,
                                              inset.Left * -1,
                                              inset.Bottom * -1,
                                              inset.Right * -1);
                var path = UIBezierPath.FromRoundedRect(insetX.InsetRect(backgroundImageView.Bounds), contentViewCornerRadius);
                path.Fill();
            });
        }
예제 #9
0
 public override void DrawText(
     CoreGraphics.CGRect rect
     )
 {
     base.DrawText(_edgeInsets.InsetRect(rect));
 }
예제 #10
0
        public override void DrawText(RectangleF rect)
        {
            var insets = new UIEdgeInsets(0, 2, 0, 2);

            base.DrawText(insets.InsetRect(rect));
        }
예제 #11
0
        public override void DrawText(CGRect rect)
        {
            var insets = new UIEdgeInsets(TopInset, LeftInset, BottomInset, RightInset);

            base.DrawText(insets.InsetRect(rect));
        }
예제 #12
0
 public override CGRect TextRect(CGRect forBounds)
 {
     return(base.TextRect(inset.InsetRect(forBounds)));
 }
예제 #13
0
 public override void DrawText(CGRect rect)
 {
     base.DrawText(_inset.InsetRect(rect));
 }
예제 #14
0
        public override CoreGraphics.CGRect TextRectForBounds(CoreGraphics.CGRect bounds, nint numberOfLines)
        {
            var textRect = base.TextRectForBounds(_edgeInsets.InsetRect(bounds), numberOfLines);

            return(_inverseEdgeInsets.InsetRect(textRect));
        }
예제 #15
0
            public override void DrawText(CGRect rect)
            {
                var insets = new UIEdgeInsets(0, 20, 0, 20);

                base.DrawText(insets.InsetRect(rect));
            }
예제 #16
0
 public override CGRect TextRect(CGRect forBounds)
 {
     return(Padding.InsetRect(forBounds));
 }
예제 #17
0
        public override void DrawText(CGRect rect)
        {
            Layer.CornerRadius = rect.Height / 2;
            var insetsWithBorder = ActualInsetsWithBorder();
            var insets = new UIEdgeInsets(
                top: insetsWithBorder.Height,
                left: insetsWithBorder.Width,
                bottom: insetsWithBorder.Height,
                right: insetsWithBorder.Width);

            var rectWithoutInsets = insets.InsetRect(rect);
            base.DrawText(rectWithoutInsets);
        }
 public override void DrawText(CoreGraphics.CGRect rect)
 {
     base.DrawText(Padding.InsetRect(rect));
 }
예제 #19
0
 public override void DrawText(RectangleF rect)
 {
     var insets = new UIEdgeInsets(0, 2, 0, 2);
     base.DrawText(insets.InsetRect(rect));
 }
        public override CGRect TextRect(CGRect forBounds)
        {
            var padding = new UIEdgeInsets(0, 10, 0, 0);

            return(base.TextRect(padding.InsetRect(forBounds)));
        }
예제 #21
0
        public virtual CGRect TextRectForBounds(CGRect forBounds)
        {
            var padding = new UIEdgeInsets(20, 50, 0, 0);

            return(base.TextRect(padding.InsetRect(forBounds)));
        }
예제 #22
0
 public override RectangleF TextRect(RectangleF forBounds)
 {
     return(base.TextRect(inset.InsetRect(forBounds)));
 }
예제 #23
0
        public override void Draw(CGRect rect)
        {
            var insets = new UIEdgeInsets(0, 9, 0, 9);

            base.Draw(insets.InsetRect(rect));
        }