viewControllers = [chatTab, friendTab,voiceTab,appTab,meTab]
self.tabBar.isTranslucent = true;
self.tabBar.backgroundImage = UIImage(named: "tab bar")
self.tabBar.shadowImage = UIImage()
self.tabBar.barStyle = UIBarStyle.black//去掉上面的黑线
// 其实默认的NavigationController 下也有一条线的 ,如下方法也可以去掉
// self.navigationController.navigationBar.barStyle = UIBaselineAdjustmentNone;
.imageWithRenderingMode(.AlwaysOriginal))使用图片的原始颜色
tab.tabBarItem=UITabBarItem(title:StringResource.message,image:UIImage(named:"tab_icon_comchat_default")?.withRenderingMode(.alwaysOriginal), selectedImage: UIImage(named: "tab_icon_comchat_select")?.withRenderingMode(.alwaysOriginal))
设置默认和选中下的字体颜色
tab.tabBarItem.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.init(hexString: "#10307F")], for: .normal);
tab.tabBarItem.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.init(hexString: "#10307F")], for: .highlighted);tab.tabBarItem.imageInsets = UIEdgeInsetsMake(-6, 0, 0, 0)设置中间图片突出