How to set backgroundColor of UISegmentedControl to white in iOS 13

后端 未结 4 1240
温柔的废话
温柔的废话 2021-02-05 07:08

iOS 13 introduced some changes to the UISegmentedControl including a really nice animation when switching the selected segment. However I\'m noticing that it\'s not displaying t

4条回答
  •  孤独总比滥情好
    2021-02-05 07:53

    In Xamarin.iOS this worked for me:

    class MySegmentedControl : UISegmentedControl
    {
        int insertedIndex = 0;
    
        public override void InsertSubview(UIView view, nint atIndex)
        {
            base.InsertSubview(view, atIndex);
    
            if (insertedIndex == 2 || insertedIndex == 3)
                view.Hidden = true;
    
            insertedIndex++;
        }
    }
    

提交回复
热议问题