Example #1
0
        public override void LoadView()
        {
            base.LoadView();
            TitleScrollView = new UIScrollView
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor                = UIColor.White,
                CanCancelContentTouches        = false,
                ShowsHorizontalScrollIndicator = false,
                Bounces  = false,
                Delegate = this
            };
            View.AddSubview(TitleScrollView);

            _bottomLine = new UIView {
                BackgroundColor = _tabColor
            };
            TitleScrollView.AddSubview(_bottomLine);

            _tabIndicator = new UIView {
                BackgroundColor = _tabColor
            };
            TitleScrollView.AddSubview(_tabIndicator);

            ContentScrollView = new UIScrollView
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                DelaysContentTouches           = false,
                ShowsHorizontalScrollIndicator = false,
                PagingEnabled = true,
                ScrollEnabled = true,
                Delegate      = this
            };
            View.AddSubview(ContentScrollView);

            View.AddConstraints(
                TitleScrollView.AtTopOf(View),
                TitleScrollView.AtLeftOf(View),
                TitleScrollView.AtRightOf(View),
                TitleScrollView.Height().EqualTo(_tabHeight),

                ContentScrollView.Below(TitleScrollView),
                ContentScrollView.WithSameWidth(TitleScrollView),
                ContentScrollView.AtBottomOf(View)
                );
        }
Example #2
0
        private void AdjustConstraints()
        {
            View.RemoveConstraints(View.Constraints);

            View.AddConstraints(
                ShowOnBottom ?
                TitleScrollView.AtBottomOf(View) :
                TitleScrollView.AtTopOf(View),

                TitleScrollView.AtLeftOf(View),
                TitleScrollView.AtRightOf(View),
                TitleScrollView.Height().EqualTo(_tabHeight),

                ContentScrollView.WithSameWidth(TitleScrollView),

                ShowOnBottom ?
                ContentScrollView.Above(TitleScrollView) :
                ContentScrollView.Below(TitleScrollView),

                ShowOnBottom ?
                ContentScrollView.AtTopOf(View) :
                ContentScrollView.AtBottomOf(View)
                );
        }