Example #1
0
        public PagerBar(PagerStyle style)
        {
            this.Frame           = new CGRect(0, 0, 0, style.SelectedStripSize);
            this.style           = style;
            this.BackgroundColor = style.BarBackgroundColor;

            const int border       = 1;
            var       bottomBorder = new UIView(new CGRect(0, this.Bounds.Height - border, this.Bounds.Width, border))
            {
                BackgroundColor  = style.BottomBorderColor,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin,
            };

            this.AddSubview(bottomBorder);

            var frame = this.Bounds;

            frame.Y      = this.Bounds.Height - style.SelectedStripSize - style.SelectedStripMargin;
            frame.Height = style.SelectedStripSize;

            if (style.SelectedStripStyle == PagerStyle.StripStyle.Dot)
            {
                frame.Width = style.SelectedStripSize;
            }

            frame.X = (this.Bounds.Width / 2) - (frame.Width / 2);

            this.selectedView = new UIView(frame)
            {
                BackgroundColor = GetStripColor(0),
            };

            if (style.SelectedStripStyle == PagerStyle.StripStyle.Rounded || style.SelectedStripStyle == PagerStyle.StripStyle.Dot)
            {
                this.selectedView.Layer.CornerRadius = style.SelectedStripSize * 0.5f;
            }

            if (style.SelectedStripStyle == PagerStyle.StripStyle.Dot)
            {
                this.selectedView.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleLeftMargin;
            }
            else
            {
                this.selectedView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
            }

            this.AddSubview(this.selectedView);
        }
Example #2
0
 /// <summary>
 /// Clones the given style.
 /// </summary>
 /// <param name="other">Other.</param>
 public PagerStyle(PagerStyle other)
 {
     this.BarHeight                      = other.BarHeight;
     this.BarBackgroundColor             = other.BarBackgroundColor;
     this.PagesBackgroundColor           = other.PagesBackgroundColor;
     this.SelectedStripColors            = other.SelectedStripColors.ToArray();
     this.BottomBorderColor              = other.BottomBorderColor;
     this.LabelFont                      = other.LabelFont;
     this.SelectedStripSize              = other.SelectedStripSize;
     this.SelectedLabelColor             = other.SelectedLabelColor;
     this.UnselectedLabelColor           = other.UnselectedLabelColor;
     this.SelectedStripStyle             = other.SelectedStripStyle;
     this.SelectedStripMargin            = other.SelectedStripMargin;
     this.SelectedStripAnimationDuration = other.SelectedStripAnimationDuration;
     this.SelectedStripAnimation         = other.SelectedStripAnimation;
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Pager.PagerViewController"/> class.
 /// </summary>
 /// <param name="style">The style of the pager.</param>
 /// <param name="children">All children view controllers.</param>
 public PagerViewController(PagerStyle style, params UIViewController[] children)
 {
     this.children = children;
     this.style    = new PagerStyle(style);
 }