ios Changing UIScrollView scrollbar color to different colors

后端 未结 17 2347
我在风中等你
我在风中等你 2020-12-05 07:16

How can we change color of UIScrollview\'s scroll indicator to something like blue, green etc.

I know we can change it to white, black. But other then these colors.

17条回答
  •  失恋的感觉
    2020-12-05 07:29

    please use below code on iOS Renderer

     private bool _layouted;
     public override void LayoutSubviews()
     {
           base.LayoutSubviews();
           if (!_layouted)
           {
                this.Layer.BorderColor = UIColor.Red.CGColor;
                var Verticalbar = (UIImageView)this.Subviews[this.Subviews.Length - 1];
    
                Verticalbar.BackgroundColor = Color.FromHex("#0099ff").ToUIColor();
                var Horizontlebar = (UIImageView)this.Subviews[this.Subviews.Length - 2];
    
                Horizontlebar.BackgroundColor = Color.FromHex("#0099ff").ToUIColor();
                _layouted = true;
           }
    }
    

提交回复
热议问题