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定义了不同类型 ...
随机推荐
- 启动hadoop报192.168.1.151: Address 192.168.1.151 maps to node1, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
使用root用户启动hadoop的时候报错: [root@node1 ~]# su - hadoop -c start-all.sh starting namenode, logging to /ap ...
- PHP读取一个目录下的文件个数
<?php function FileCount($dir){ global $count; if(is_dir($dir)&&file_exists($dir)){ $ob=s ...
- Readonly和disabled的区别 display:none和visible:hidden的区别
怎样使input中的内容为只读,也就是说不让用户更改里面的内容. <input type="text" name="input1" value=" ...
- [C++][语言语法]标准C++中的string类的用法总结
转自:http://www.cnblogs.com/xFreedom/archive/2011/05/16/2048037.html 要想使用标准C++中string类,必须要包含 #include ...
- js格式化日期 年月日
/** * 格式化日期 * @param value * @param row ...
- WebView的返回功能
WebView 实现返回到最后一个 在退出 import android.app.Activity; import android.os.Bundle; import android.view.Key ...
- office软件
32位系统office2013: http://pan.baidu.com/s/1bnCqMZ1 64位系统office2013: http://pan.baidu.com/s/1i33rdHF vi ...
- 2016 ACM/ICPC Asia Regional Qingdao Online HDU5878
链接:http://acm.hdu.edu.cn/showproblem.php?pid=5878 解法:先保存,再二分查询~具体http://blog.csdn.net/coder_xia/arti ...
- 编写一个JAVA小程序取得IP地址
在TCP/IP 互联网时,经常会需要查询自己主机的IP地址和www服务器的IP地址.虽然,我们可以使用IPCONFIG 和PING 进行IP地址查询,但是如果在应用程序或APPLET中使用此命令会破坏 ...
- 阿里巴巴Double分布式服务框架
开发人员梁飞的blog : http://javatar.iteye.com/ 梁飞关于Double框架的专访: http://www.iteye.com/magazines/103 Double项目 ...