随笔分类 - IOS(Objective-C)
摘要:1 - (void)drawRect:(CGRect)rect 2 { 3 4 // 1.获取上下文 5 CGContextRef ctx = UIGraphicsGetCurrentContext(); 6 // 画圆 7 CGContextAddArc(ctx...
阅读全文
摘要:1 // 1.获取图形上下文 2 CGContextRef ctx = UIGraphicsGetCurrentContext(); 3 4 // 2. 绘制三角形 5 // 设置起点 6 CGContextMoveToPoint(ctx, 10...
阅读全文
摘要:1 #import 2 3 @interface NJRectView : UIView 4 @end 5 6 7 #import "NJRectView.h" 8 9 @implementation NJRectView10 11 - (void)drawRect:(CGRect)re...
阅读全文
摘要:1 #import 2 3 @interface NJLineView : UIView 4 @end 5 6 7 #import "NJLineView.h" 8 9 @implementation NJLineView10 11 // 当自定义view第一次显示出来的时候就会调用dr...
阅读全文
摘要:1 @interface NJTextImage : UIView 2 @end 3 4 5 @implementation NJTextImage 6 7 - (void)drawRect:(CGRect)rect 8 { 9 // [self test];10 // ...
阅读全文
摘要:1 #import 2 3 @interface NJContatc : NSObject 4 5 @property (nonatomic, copy) NSString *name; 6 @property (nonatomic, copy) NSString *phoneNumber...
阅读全文
摘要:1 存储数据到NSUserDefaults(偏好设置)中 // 获取NSUserDefaults对象 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; // 保存数据(如果设置数据之后没有同步, 会在将来某一时间点...
阅读全文
摘要:1 用沙盒路径拼接 // 获取应用程序沙河目录 NSString *home = NSHomeDirectory(); // 不建议写/ NSString *path = [home stringByAppendingString:@"/Documents"]; // 不建议Documen...
阅读全文