How do I change background color of UITabItem when item is selected

前端 未结 11 1045
暖寄归人
暖寄归人 2021-02-01 19:15

I would like a different background color when the user selects a tab bar item than when it is unselected.

11条回答
  •  囚心锁ツ
    2021-02-01 19:53

    In Swift

    UITabBar.appearance().selectionIndicatorImage = UIImage(named: "tabSelected")
    

    with an image tabSelected@2x.png of size 98x98 pixels

提交回复
热议问题