美文网首页工作生活
UITabBarItme、UINavigationItem常见操

UITabBarItme、UINavigationItem常见操

作者: 独孤流 | 来源:发表于2019-07-04 17:21 被阅读0次
一、UITabBarItem

1.1、设置图片及文字相关的位移

vc.tabBarItem.imageInsets=UIEdgeInsetsMake(-5,0,5,0);
vc.tabBarItem.titlePositionAdjustment = UIOffsetMake(0, -5);

1.2、设置图片保留图片的颜色

UIImage *originImg = [UIImage imageNamed:[NSString stringWithFormat:@"xxx",iconName]];
UIImage *selectImg = [originImg imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
vc.tabBarItem.selectedImage = selectImg;

1.3、设置Item的字体及颜色

 //Normal
 [[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName:xxx} forState:UIControlStateNormal];
 //Selected
 [[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15],NSForegroundColorAttributeName:xxxx} forState:UIControlStateSelected];
二、UINavigationBar

2.1 去掉导航栏下面的阴影线

// 设置背景色
 [navigationBar setBackgroundImage:[UIImage xxxx]] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
// 设置阴影为空的图片
    [navigationBar setShadowImage:[UIImage new]];

相关文章

网友评论

    本文标题:UITabBarItme、UINavigationItem常见操

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