开发所得(一)

[[UIApplication sharedApplication] setIdleTimerDisabled:YES];//不锁屏

https://github.com/CoderZhuXH/XHLaunchAd

[[[self.contentSize componentsSeparatedByString:@"*"] firstObject] floatValue] //通过字符串中字符进行截取字段

沙盒中只能保存OC中的基本数据,自定义的对象不能直接存入。 存入方式如下。

//    1,获取家目录路径的函数://    NSString *homeDir = NSHomeDirectory();//    2,获取Documents目录路径的方法://    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);//    NSString *docDir = [paths objectAtIndex:0];//    3,获取Caches目录路径的方法:    NSArray *paths =NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);    NSString *cachesDir = [paths objectAtIndex:0];//    4,获取tmp目录路径的方法://    NSString *tmpDir = NSTemporaryDirectory();        //假设我们需往cache 存入数据,并命名为test的txt格式文件中    NSString *filePath = [cachesDir stringByAppendingPathComponent:@"test.txt"];    NSArray *dic = [[NSArray alloc] initWithObjects:@"test",@"test1",nil];        if([dic writeToFile:filePath atomically:YES]){        NSLog(@"存入成功");

}

//取出数据 打印

NSLog(@"%@",[NSArray arrayWithContentsOfFile:filePath]);

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容