//居中对齐
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init] ;
[paragraphStyle setAlignment:NSTextAlignmentCenter];
NSDictionary *tabBarTitleUnselectedDic = @{NSForegroundColorAttributeName:UIColor.from(CAssetGray),NSFontAttributeName:[UIFont systemFontOfSize:10.f weight:UIFontWeightMedium]};
NSDictionary *tabBarTitleSelectedDic = @{NSForegroundColorAttributeName:UIColor.from(CAssetPink),NSFontAttributeName:[UIFont systemFontOfSize:10.f weight:UIFontWeightMedium]};
//修改tabberItem的title颜色
item.selectedTitleAttributes = tabBarTitleSelectedDic;
item.unselectedTitleAttributes = tabBarTitleUnselectedDic;
要注意的一点是,他的内部实现里使用了四舍五入去舍取得到文字的居中位置。所以遇到汉字会出现不准的情况,需要把roundf的方法去掉