多功能Label
来源:互联网 发布:java main spring 编辑:程序博客网 时间:2024/06/10 01:48
JJLabel
有长按复制的功能,且在将要复制时和将要结束复制时皆有block事件,(此功能默认开启)代码如下:
JJLabel *copyLab = [[JJLabel alloc] init];copyLab.frame = CGRectMake(20, 100, (superViewWidth - 20 * 2), 30);copyLab.text = @"阿杰说:这是被copy的内容,copy时会变蓝";copyLab.textAlignment = NSTextAlignmentCenter;copyLab.subFromIndexString = @"阿杰说:";copyLab.appendString = @"ajie";[self.view addSubview:copyLab];__weak __typeof(&*copyLab) weakLab = copyLab;copyLab.willShowMenu = ^(){ weakLab.textColor = [UIColor blueColor];};copyLab.willHiddenMenu = ^(){ weakLab.textColor = [UIColor blackColor];};
可以非常简洁的设置行间距和字间距,并且容易的得到label的高度--isCopy 可以设置是否有复制功能
JJLabel *spaceLab = [[JJLabel alloc] init];spaceLab.text = @"这是一个可以自定义行间距和字间距的label,并且可以直接获取到label的高度,大大提升了码农的工作效率";spaceLab.numberOfLines = 0;spaceLab.lineSpace = 5.0f;spaceLab.characterSpace = 5.0f;spaceLab.isCopy = NO;CGFloat labHeight = [spaceLab getLableHeightWithMaxWidth:(superViewWidth - 30 * 2)];spaceLab.frame = CGRectMake(30, 150, (superViewWidth - 30 * 2), labHeight);[self.view addSubview:spaceLab];
可以将label中第一次出现的某字段,改变字体大小和颜色
JJLabel *changeLab = [[JJLabel alloc] init];changeLab.text = @"阿杰说:这是一个可以自定义行间距和字间距的label,并且可以直接获取到label的高度,大大提升了码农的工作效率";changeLab.numberOfLines = 0;changeLab.isCopy = NO;JJLabelItem *item = [JJLabelItem new];item.itemContent = @"阿杰说:";item.itemColor = [UIColor orangeColor];item.itemFont = [UIFont systemFontOfSize:30];changeLab.changeArray = @[item];CGFloat labHeight = [changeLab getLableHeightWithMaxWidth:(superViewWidth - 30 * 2)];changeLab.frame = CGRectMake(30, 300, (superViewWidth - 30 * 2), labHeight);[self.view addSubview:changeLab];
资源在此 JJLabel
0 0
- 多功能Label
- label
- Label
- label
- Label
- label
- Label
- label
- label
- label
- Label
- label
- 多功能计算器
- 多功能输入法
- 多功能键盘
- 多功能手机充电器
- 多功能筛选
- 多功能按键
- python的Theano库
- JDK各个版本的新特性jdk1.5-jdk8
- 代码优化:将重复代码封装成函数(3)
- 刚学的网页换肤
- python subprocess
- 多功能Label
- 编程之美 - 1 的数目
- Python2.6.6安装配置ICE3.4.2开发环境
- 如何坚持每周写一篇博客
- 【CodeForces】[658A]Bear and Reverse Radewoosh
- LIS最长上升子序列O(n^2)&O(nlogn)
- OC 中的 block
- MapReduce总结 (1)
- iOS——UINavigationController简单实用以及内存警告处理过程