iOS tintColor与backgroundColor
来源:互联网 发布:iphone铃声助手 mac 编辑:程序博客网 时间:2024/04/30 23:42
UIView及其子类有两个设置颜色的属性:tintColor 和 backgroundColor ?
你知道他们的区别么?
1.backgroundColor顾名思义就是背景颜色,就是整个UIView子类的充满视图的颜色;
特点:
(1).默认父视图设置的背景颜色,如果子视图的背景颜色也是default那么默认透明的视图都是父视图的背景颜色
(2)背景颜色对于视图上的带有线条的内容是无法改变的;比如字体颜色
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就可以设置改变镂空图片的颜色
可以从上图中看出,tintColor从父视图一直传递了过来;
由此我们可以做一个,比较偷懒的做法,把所有的默认的线条颜色都改为一样的,用如何做呢?
改变window的tintColor即可,因为window是最底层的view嘛!
[[UIApplication sharedApplication] keyWindow].tintColor = [UIColor orangeColor]; 由此会产生连锁反应原文地址 http://www.68idc.cn/help/buildlang/ask/20150124188072.html
- iOS tintColor与backgroundColor
- iOS tintColor 与 backgroundColor
- iOS开发- tintColor 与backgroundColor区别研究
- ios tintColor 与backgroundColor区别研究
- iOS开发- tintColor 与backgroundColor区别研究
- iOS tintColor与backgroundColor的区别
- ios barTintColor backgroundColor tintColor UITextAttributeTextColor的区别
- iOS开发中,tintColor和 backgroundColor的区别
- ios UI tintcolor 与 bartintcolor
- navigationcontroller barTintColor, tintColor, backgroundColor的不同
- cocoa touch——UIView——backgroundColor,tintColor
- TintColor
- tintcolor
- ios 修改UITableViewCell的backgroundColor
- ios 修改UITableViewCell的backgroundColor
- backgroundcolor
- iOS tintColor和barTintColor的区别
- iOS--UIWebView设置backgroundColor无效问题
- SAP HANA 基础架构简介(一)
- MySQL命令大全
- java 反射调用 私有构造类中 private static final 属性的方法
- Android中Activity四种启动模式详解
- ubuntu常用包管理命令
- iOS tintColor与backgroundColor
- 浅谈WebView
- 大数据笔试面试问题之分治法解决
- iOS详细讲解沙盒机制
- JS判断文本框内容改变事件的简单实例
- HTTP协议详解
- dom修改
- iOS 开发 屏幕尺寸 --------开发者必备
- [Python]输出中文报错的解决方法