设置UILabel的内间距
来源:互联网 发布:c 定义json数组 编辑:程序博客网 时间:2024/04/30 06:20
因为UILabel没有相关属性设置内间距,只能自己重新自定义
//1.header file
#import
@interface InsetsLabel : UILabel
@property(nonatomic) UIEdgeInsets insets;
-(id) initWithFrame.:(CGRect)frame. andInsets: (UIEdgeInsets) insets;
-(id) initWithInsets: (UIEdgeInsets) insets;
@end
//2. implementation file
@implementation InsetsLabel
@synthesize insets=_insets;
-(id) initWithFrame.:(CGRect)frame. andInsets:(UIEdgeInsets)insets {
self = [super initWithFrame.:frame];
if(self){
self.insets = insets;
}
return self;
}
-(id) initWithInsets:(UIEdgeInsets)insets {
self = [super init];
if(self){
self.insets = insets;
}
return self;
}
-(void) drawTextInRect:(CGRect)rect {
return [super drawTextInRect:UIEdgeInsetsInsetRect(rect, self.insets)];
}
@end
调用部分
InsetsLabel * lblTitle=[[InsetsLabel alloc] initWithFrame.:CGRectMake(0, 35+25*i, 185, 22)];
[lblTitle setInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
- 设置UILabel的内间距
- 设置UITextField的内间距
- [iOS] UILabel 设置内容的间距及高度的计算
- 自定义UILabel设置行距和字间距的各种方法
- UILabel设置行间距和字间距
- 8.给UILabel分段设置不同的颜色以及设置每行的间距
- iOS开发1-UILabel设置行间距和字间距
- 设置form的间距
- 设置UIBarButtonItem的间距
- UILabel调整字间距
- UILabel的AttributedString设置
- UILabel的所有设置
- 设置UILabel的内边距
- HTML+CSS基础 letter-spacing 设置p标签内的字间距
- 设置UITextView的内间距inset为0;UIScrollview的pagingEnabled为YES的时候设置不同Page之间的间距
- [iOS]修改UILabel的行间距/段间距/缩进
- html table的间距设置
- 设置tableViewCell之间的间距
- jsp页码通过href标签传中文参数
- 这就是Thinkpad S1 yoga 20CD-A06SCD问题
- 动态的获取ios键盘的高度
- 上海的it环境怎样,打算去上海看看
- windows 蓝牙开源工具包分析及C#实例
- 设置UILabel的内间距
- yum 错误TypeError: rpmdb open failed
- MySQL 服务安装启动
- Omnet下安装Inet工具箱
- osg如何画网格
- js正则函数match、exec、test、search、replace、split使用介绍集合
- 用FPGA设计软件无线电和调制解调器
- rdis3.0集群安装
- 【DSP杂记】