iOS 设置button中图文位置
方法一.
-(CGRect)imageRectForContentRect:(CGRect)contentRect {
return CGRectMake(self.width - kImageW, 0, kImageW, self.height);
}
-(CGRect)titleRectForContentRect:(CGRect)contentRect {
return CGRectMake(0, 0, self.width - kImageW, self.height);
}
方法二.
- (void)layoutSubviews {
[super layoutSubviews];
self.textLabel.frame = CGRectMake(0, 0, self.width, self.height);
}
iOS 设置button中图文位置的更多相关文章
- 通过代码设置button中文字的对齐方式
// button.titleLabel.textAlignment = NSTextAlignmentLeft; 这句无效 button.contentHorizontalAlignment = U ...
- IOS设置button 图片 文字 上下、左右
[btn setImage:imgNor forState:UIControlStateNormal]; [btn setImage:imgSel forState:UIControlStateSel ...
- iOS 设置Label中特定的文字大小和颜色
直接上代码: _price = @"27"; NSMutableAttributedString *attributedString = [[NSMutableAttributed ...
- iOS 设置button文字过长而显示省略号的解决办法
UIButton * button =[UIButton buttonWithType:UIButtonTypeCustom];button.titleLabel.adjustsFontSizeToF ...
- iOS设置UITableView中Cell被默认选中后怎么触发didselect事件
//默认选中某个cell [self.searchResultTV selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] a ...
- iOS 设置文本中指定某段文本的颜色 大小
NSString *money = @"300"; NSString *perStr = @"元/时"; NSString *text = [NSString ...
- iOS 设置 文字和 图片的位置
1.我最开始实现这个采用的方法:重新自定义一个view,然后有两个属性label和imageView,然后设置位置布局,再添加单击手势,用代理回传点击方法. 2.第二种方法:自定义一个Button继承 ...
- iOS中 图文混排/自定义图文混排 作者:韩俊强
指示根视图:(准备几张图片,把label加载在window上) CustomLable *label = [[CustomLable alloc]initWithFrame:CGRectMake(0, ...
- Delphi for iOS开发指南(4):在iOS应用程序中使用不同风格的Button组件
http://blog.csdn.net/DelphiTeacher/article/details/8923481 在FireMonkey iOS应用程序中的按钮 FireMoneky定义了不同类型 ...
随机推荐
- 图示-Centos7完整安装
工作过程中,一些未接触过Centos,或未安装过Centos的同事经常会问,如何安装?这个事说简单真简单,只有操作过一次,第二次就能够熟练的自己动手安装:但说难也难,如果没人带,第一次安装的时候确实不 ...
- SURF
推荐:http://www.cnblogs.com/tornadomeet/archive/2012/08/17/2644903.html SURF-Speeded Up Robust Feature ...
- 给我发邮件(qq)| 和我联系
qq邮箱开放平台(只能是qq对qq): 简单点的发邮件: 和我联系
- SDUT 2608:Alice and Bob
Alice and Bob Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 Alice and Bob like playing ...
- c#sqlhelper之用法
MySqlParameter[] a=new MySqlParameter[]{new MySqlParameter("@stu_id",stu_id)}; 参数使用
- JQuery知识快览之四—样式
前面我们获取了对象集,本文介绍怎么控制对象集的样式 基本概念 在一个html页面中,我们有两种方式来控制一个对象的样式,用HTML attribute控制,或者用CSS类来控制,这两种方法虽然都能控制 ...
- Alignment
Alignment Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 14547 Accepted: 4718 Descriptio ...
- ural 1113,jeep problem
题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1113 网上的解答铺天盖地.我硬是花了两天才懂了点. wiki上的解释:https://e ...
- readDouble
readDouble是从一个文件中读取double类型的数据
- shell脚本之间互相调用
在Shell中要如何调用别的shell脚本,或别的脚本中的变量,函数呢? 方法一: . ./subscript.sh 方法二: source ./subscript.sh 注意: .两个点之间,有空格 ...