swift-tabbar修改文字大小和位置
2017-02-08 本文已影响78人
A_rcher34
本篇说明的是调节系统的tabbar上文字的大小和位置
-
先上代码:
let photoVC = DemoPhotoViewController()
photoVC.setShowType(ShowType.present)
let photoNav = BaseNavigationController.init(rootViewController: photoVC)
photoNav.tabBarItem.title = "照片"
photoNav.tabBarItem.setTitleTextAttributes(NSDictionary.init(dictionary: [NSFontAttributeName : UIFont.systemFont(ofSize: 15)]) as? [String : Any], for: UIControlState.normal)
photoNav.tabBarItem.titlePositionAdjustment = UIOffsetMake(0, -12)
-
调节文字的大小
photoNav.tabBarItem.setTitleTextAttributes(NSDictionary.init(dictionary: [NSFontAttributeName : UIFont.systemFont(ofSize: 15)]) as? [String : Any], for: UIControlState.normal)
-
调节文字的位置
photoNav.tabBarItem.titlePositionAdjustment = UIOffsetMake(0, -12)