navigationcontroller barTintColor, tintColor, backgroundColor的不同

本文深入探讨了iOS导航栏的背景颜色、标题颜色、按钮颜色等关键属性的配置方式和区别,帮助开发者准确理解并应用这些颜色配置,提升用户界面的美观性和一致性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

barTintColor : The tint color to apply to the navigation bar background.


tintColor : The tint color to apply to the navigation items and bar button items.


backgroundColor : change the background color of navigationBar


backgroundColor特点:

(1).默认父视图设置的背景颜色,如果子视图的背景颜色也是default那么默认透明的视图都是父视图的背景颜色

(2)背景颜色对于视图上的带有线条的内容是无法改变的;比如字体颜色

tintcolor特点

(1).tintColor是描述线条轮廓的一种颜色,该颜色默认具有传递性,默认状态下最底部的视图的tintcolor会一直往上面的视图传递

(2).如果子视图改变了tintcolor那么将会和父视图的tintColor不一样;传递链从此处断开

(3).navagation的item的  tintColor和controller自带的View不是在同一层次上;改变controller的view的tintColor对navagation的tintColor没有颜色;

(4).由于,tintColor的特性,我们可以对镂空的图片(如tabbar的image和 BarButtonItem的image)进行设置tintColor就可以设置改变镂空图片的颜色

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值