可以先在程序打印沙盒路径: NSLog(@"路径%@",NSHomeDirectory()); 其中一个沙盒存储更新与读取方法方法 #import <Foundation/Foundation.h> @interface ConfigData : NSObject //保存到沙盒中 + (void) ...
分类:
移动开发 时间:
2016-11-13 18:53:59
阅读次数:
209
#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // // NSLog(@"缓 ...
分类:
其他好文 时间:
2016-11-02 20:18:57
阅读次数:
193
在PCH文件中添加如下代码:#ifdef __OBJC__ //保证代码只会在OC中引用 #ifdef DEBUG #define NSLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ ...
分类:
移动开发 时间:
2016-10-27 22:52:23
阅读次数:
210
四种容错格式的尺寸:27、31、31、35. // 5、将CIImage转换成UIImage,并放大显示 UIImage *imagex = [UIImage imageWithCIImage:outputImage]; NSLog(@"%f", imagex.size.height); 因为生成的 ...
分类:
移动开发 时间:
2016-10-25 01:52:43
阅读次数:
253
(一)[self class] 与 [super class] 下面代码输出什么@implementation Son : Father - (id)init { self = [super init]; if (self) { NSLog(@"%@", NSStringFromClass([sel ...
分类:
其他好文 时间:
2016-10-19 19:35:18
阅读次数:
215
iOS 程序员 6 级考试(答案和解释) 我是前言 1. 下面的代码分别输出什么? @implementation Son : Father- (id)init { self = [super init]; if (self) { NSLog(@"%@", NSStringFromClass([se ...
分类:
移动开发 时间:
2016-10-19 19:34:38
阅读次数:
188
//获取当前时间 时间根据格林威治时间显示 //时间 8小时 英国格林威治 7小时 NSDate *date = [NSDate date]; NSLog(@"%@",date); //NSZone 计算时区 //根据当前时间 获得一个时间 参数是秒 NSDate *someDate = [NSDa ...
分类:
移动开发 时间:
2016-10-08 19:42:23
阅读次数:
168
在开发的过程中,打印调试日志是一项比不可少的工程,但是在iOS 10中NSLog打印日志被屏蔽了,就不得不使用自定义Log 使用UTF8String的原因就是printf是C语言的,所以需要通过这个方法转换一下才能打印。 ...
分类:
其他好文 时间:
2016-10-01 12:27:36
阅读次数:
137
1.处理NSLog事件(开发者模式打印,发布者模式不打印) 2.在OC语言的情况下导入某些头文件 3.处理循环引用问题(处理当前类对象) 4.获取屏幕宽高 5.判断iOS8或更高系统版本(谨慎使用,floatValue是不靠谱的,具体原因请看:http://www.jianshu.com/p/528 ...
分类:
移动开发 时间:
2016-09-26 12:24:13
阅读次数:
227
block用来保存一段代码 block的标志:^ block跟函数很像: 1. 可以保存代码 2. 有返回值 3. 有形参 4. 调用方式一样 定义bolock变量 例1: void (^myBlock)() = ^{ NSLog(@“———————“); }; 利用block变量调用block内部 ...
分类:
其他好文 时间:
2016-09-23 19:46:22
阅读次数:
138