storyboard自定义tabbar按钮

2017-06-07  本文已影响56人  BlueBar

系统默认tabbar的按钮选中时纯色的状态,会把图片的颜色覆盖掉,要设置图片的不渲染

UIImageRenderingMode​枚举值 才能显示自定义选中的图片

let tabBarItems = self.tabBar.items;

        

        let item0 = tabBarItems![0]

        let item1 = tabBarItems![1]

        let item2 = tabBarItems![2]

        item0.selectedImage = UIImage(named: "Mine_select")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)

        item1.selectedImage = UIImage(named: "Mine_select")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
上一篇下一篇

猜你喜欢

热点阅读