美文网首页
storyboard自定义tabbar按钮

storyboard自定义tabbar按钮

作者: BlueBar | 来源:发表于2017-06-07 15:13 被阅读56次

    系统默认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)
    

    相关文章

      网友评论

          本文标题:storyboard自定义tabbar按钮

          本文链接:https://www.haomeiwen.com/subject/sztafxtx.html