コード例 #1
0
            public override void LayoutSubviews()
            {
                base.LayoutSubviews();

                var subviews = Subviews.ToList();
                var bounds   = Bounds;

                if (bounds.Size == size)
                {
                    return;
                }
                size = bounds.Size;
                var backButton = subviews.OfType <UIButton>().FirstOrDefault();

                if (backButton != null)
                {
                    Console.WriteLine(backButton);
                    var frame = Bounds;
                    frame.Height    *= (30 / 44);
                    frame.Width      = frame.Height * (37 / 30);
                    backButton.Frame = frame;
                }

                var style = this.GetStyle();

                this.BarStyle = style.BarStyle;
                this.SetTitleVerticalPositionAdjustment(style.MainTextFont.PointSize * -.5f, UIBarMetrics.Default);
                this.TitleTextAttributes = new UIStringAttributes
                {
                    Font            = style.MainTextFont.WithSize(style.MainTextFont.PointSize * 1.5f),
                    ForegroundColor = UIColor.White,
                };
            }
コード例 #2
0
        public override void DidAddSubview(NSView NSView)
        {
            base.DidAddSubview(NSView);

            // Reference the list as we don't know where
            // the items has been added other than by getting the complete list.
            // Subviews materializes a new array at every call, which makes it safe to
            // reference.
            _shadowChildren = Subviews.ToList();
        }
コード例 #3
0
        void PrepareForNewPosition(FrontViewPosition newPosition)
        {
            if (RearView == null || RightView == null)
            {
                return;
            }

            int symetry = newPosition < FrontViewPosition.FrontViewPositionLeft ? -1 : 1;

            var rearIndex  = Subviews.ToList().IndexOf(RearView);
            var rightIndex = Subviews.ToList().IndexOf(RightView);

            if ((symetry < 0 && rightIndex < rearIndex) || (symetry > 0 && rearIndex < rightIndex))
            {
                ExchangeSubview(rightIndex, rearIndex);
            }
        }