func setNav() {
let segmentTitles = ["aaa", "bbb", "ccc"]
// segment 去边框颜色
self.segment = UISegmentedControl(items: segmentTitles)
// 先去除边框颜色
self.segment.tintColor = UIColor.clearColor()
// 设置一个字体的字典,内容为没点击的字体大小和颜色
let unselectedTextAttributes: NSDictionary = [NSFontAttributeName: UIFont.boldSystemFontOfSize(16), NSForegroundColorAttributeName: UIColor ( red: 0.604, green: 0.5857, blue: 0.5528, alpha: 1.0 )];
self.segment.setTitleTextAttributes(unselectedTextAttributes as [NSObject : AnyObject], forState: UIControlState.Normal)
// 点击之后的字体大小和颜色
let selectedTextAttributes: NSDictionary = [NSFontAttributeName: UIFont.boldSystemFontOfSize(16), NSForegroundColorAttributeName: UIColor ( red: 0.3915, green: 0.6216, blue: 1.0, alpha: 1.0 )]
self.segment.setTitleTextAttributes(selectedTextAttributes as [NSObject : AnyObject], forState: UIControlState.Selected)
// 添加到导航栏
self.navigationItem.titleView = self.segment
}