UIButton的titleLabel
UIButton的titleLabel

@property(nonatomic, readonly, retain) UILabel *titleLabel
Description - 描述
A view that displays the value of the currentTitle property for a button. (read-only)
显示当前的button的文本(只读)
Although this property is read-only, its own properties are read/write. Use these properties primarily to configure the text of the button.
虽然这个属性是只读的,但它自己的子属性是可读写的,你可以用他们来设置一些样式:
For example:
UIButton *button = [UIButton buttonWithType: UIButtonTypeSystem];
button.titleLabel.font = [UIFont systemFontOfSize: 12];
button.titleLabel.lineBreakMode = UILineBreakModeTailTruncation;
Do not use the label object to set the text color or the shadow color. Instead, use the setTitleColor:forState: and setTitleShadowColor:forState: methods of this class to make those changes.
不要直接用label对象来设置文本颜色以及阴影颜色.相对的,你可以使用方法setTitleColor:forState: setTitleShadowColor:forState: 来做这些改变.
The titleLabel property returns a value even if the button has not been displayed yet. The value of the property is nil for system buttons.
这个titleLabel属性能够返回值,即使这个button还没有被夹在,对于系统按钮而言,这个值为空.
你可以使用这个属性来与字符串比较判断哪个按钮别点击了.

UIButton的titleLabel的更多相关文章
- iOS 中UIButton的 settitle 和 titlelabel的使用误区
UIButton中设置Titl方法包括以下几种: - (void)setTitle:(NSString *)title forState:(UIControlState)state; - (void) ...
- 设置UIButton或者UILabel显示文字的行数
需要在UIButton的titleLabel或者UILabel的text 字符串里面添加换行符号 “\n”,并且设置 UILabel的numberOfLines属性 栗子:行数要和“\n”的个数对应, ...
- UIButton修改文字大小问题
一.问题描述 通过UIButton对象font属性设置文字大小,却发现该属性在2.0.3.0就已经被废弃,ios不建议使用. 图1-1:点出UIButton对象的font属性提示被废弃 图1-2:UI ...
- UIButton关于setFont方法过时的解决方法
环境:xcode7 语言:Object-c 解决方法:更改UIButton的titleLabel属性的font值 一.新建一个Single View Application项目 二.创建一个UIBut ...
- [iOS]详解调整UIButton的title和image的位置
UIButton的默认布局是:title在右,image在左; 很多时候我们需要的是title在左边,或者title在下面,这时就需要调整UIButton的TitleLabel和ImageView的位 ...
- iOS 购物车动画
代码地址如下:http://www.demodashi.com/demo/11155.html 先看看动画效果: 项目结构: 接下来开始具体实现过程: 一.先计算动画开始结束位置 方法:- (CGPo ...
- iOS swift 关于自定义表情键盘
目录 输入框 键盘监听 键盘切换 表情装载 表情加载 表情输入 表情输出 表情显示 结束语 demo下载 demo图片: 输入框 为了让输入框能够随着用户输入内容变化自动变化高度,这里的输入框使用UI ...
- iOS学习-UIButton的imageView和titleLabel
UIButton的imageView和titleLabel的位置设置通过setImageEdgeInsets和setTitleEdgeInsets来设置 参考:http://blog.csdn.net ...
- UIBUTTON titlelabel.text 不显示
button.titlelabel.text=@"查询";设置后运行发现没事正确显示. 查找后原来UIButton分状态的,textLabel不管用 [button setTitl ...
随机推荐
- Linux 系统下安装 mysql5.7.25(glibc版)
前言:经过一天半的折腾,终于把 mysql 5.7.25 版本安装上了 Amazon Linux AMI release 2017.09 系统上,把能参考的博客几乎都看了一遍,终于发现这些细节问题,然 ...
- (转)centos7.0安装配置DRBD
原文:http://gushiren.blog.51cto.com/3392832/1685207 首先确保两台机器时间同步,配置ssh. 方法一通过yum源安装:yum安装默认路径是/etc/drb ...
- 使用not in的子查询
operand comparison_operator [NOT] in (subquery) =ANY运算符与IN等效 !=ALL或<>ALL运算符与NOT IN 等效 如果子查询返回任 ...
- JDBC(3)-使用PreparedStatement接口实现增、删、改操作
1.PreparedStatement接口引入 PreparedStatement是Statement的子接口,属于预处理操作,与直接使用Statement不同的是,PreparedStatement ...
- solr的安装及配置详细教程/solr入门教程
1 solr的下载 从Solr官方网站(http://lucene.apache.org/solr/ )下载Solr最新版本,根据Solr的运行环境,Linux下需要下载solr-7.3.1.tgz, ...
- Express4.10.2开发框架中默认app.js的代码注释
//通过require()加载了express.path等模块var express = require('express');var path = require('path');var favic ...
- 【随笔】 MyEclipse2014的安装和破解
MyEclipse,是在eclipse 基础上加上了自己的插件.MyEclipse,是在eclipse 基础上加上自己的插件开发而成的功能强大的企业级集成开发环境,主要用于Java.Java EE以及 ...
- unity收集log工具
参考 yusong:http://www.xuanyusong.com/archives/2477 凉鞋 :https://www.cnblogs.com/liangxiegame/p/Uni ...
- httpclient文件下载
http://blog.csdn.net/nupt123456789/article/details/42721003
- web_03Java ee实现定时跳转,使用C3P0,DBUtils类重构数据库操作
Web Web_02版本: 实现功能 1,定时跳转 2,C3P0连接池 3,DBUtils工具类 设计内容 1,setHeader方法 2, 3, *重点 1,定时跳转: 1,selver实现 ...