效果显示如下: 只需要子类化Label,重写DrawRect()方法即可: #import "MyLabel.h" @implementation MyLabel - (instancetype)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { } return self; } //重写UILabel的drawRect类 - (void)drawRect:(CGRect)rect{…
效果图例如以下: 一个带删除线的文本标签,继承自UILabel 自绘代码过程例如以下: 1,重写控件的drawRect方法 2,首先得到上下文对象 3,设置颜色,并指定是填充(Fill)模式还是笔刷(Stroke)模式 4,在上下文中指定删除线的起点(含x,y) 5,依据标签文字的字体,确定文字的长度(即将被画的线条的长度) 6,指定删除线的终点(含x,y) 7,渲染到上下文,完毕路径的绘制…
创建自定义子类DeleteLineLabel,继承自UILabel,然后在自定义子类DeleteLineLabel中 方法一(上下文): - (void)drawRect:(CGRect)rect { [super drawRect:rect]; CGContextRef ref = UIGraphicsGetCurrentContext(); //绘制起点 CGContextMoveToPoint(, rect.size.height * 0.5); //绘制终点 CGContextAddLi…
遇到坑了: NSString *goodsPrice = @"230.39"; NSString *marketPrice = @"299.99"; NSString* prceString = [NSString stringWithFormat:@"%@ %@",goodsPrice,marketPrice]; DLog(@"----打印--%@---",prceString); NSMutableAttributedSt…
1.获取沙盒路径 // 获取沙盒路径 NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; 2.创建文件夹 方式一: // 想在documents目录下创建一个test文件夹 NSString *path = [documentsDirectory stringByAppendingPathComponent:@"test"];…
class Cat(Animal): def __init__(self): import warnings warnings.warn("Cat类带删除线了", DeprecationWarning) def run(self): import warnings warnings.warn("run方法带删除线了", DeprecationWarning)…
iOS——文件操作NSFileManager (创建.删除,复制,粘贴)       iOS的沙盒机制,应用只能访问自己应用目录下的文件.iOS不像android,没有SD卡概念,不能直接访问图像.视频等内容.iOS应用产生的内容,如图像.文件.缓存内容等都必须存储在自己的沙盒内.默认情况下,每个沙盒含有3个文件夹:Documents, Library 和 tmp.Library包含Caches.Preferences目录.               上面的完整路径为:用户->资源库->Ap…
UILabel *testLabel = [[ UILabel alloc] initWithFrame:CGRectMake(, , , )]; testLabel.numberOfLines = ; NSString* strText = @"测试画删除线测试画删除线测试画删除线测试画删除线测试画删除线"; NSMutableAttributedString *content = [[NSMutableAttributedString alloc]initWithString:st…
UILabel *valueL = [JAppViewTools getLabel:CGRectMake(JFWidth(15), CGRectGetMaxY(proName.frame)+JFWidth(12), KSCreenWidth-JFWidth(30), JFWidth(14)) :JTextFCMake(JFFont(15), rgb(28, 218, 159))]; valueL.text = [NSString stringWithFormat:@"%@ 金币 ¥%@"…
linux命令 - ln - 创建和删除软.硬链接 在Linux系统中,内核为每一个新创建的文件分配一个Inode(索引结点),每个文件都有一个惟一的inode号.文件属性保存在索引结点里,在访问文件时,索引结点被复制到内存在,从而实现文件的快速访问. 链接是一种在共享文件和访问它的用户的若干目录项之间建立联系的一种方法.Linux中包括两种链接:硬链接(Hard Link)和软链接(Soft Link),软链接又称为符号链接(Symbolic link).符号连接相当于Windows下的快捷方…