问我的世界什么颜色的马好
-
慕慕
nsfilemanager*filemanager=[nsfilemanager defaultmanager];nsstring*str1=nshomedirectory();filepath=[[nsstring stringwithformat:@"%documents/imageviews/test.pl**t",str1]retain];nslog(@"%",_filepath);if![filemanager fileex**tsatpath:_filepath]){/如果不存在,则说明是第一次运行这个程序,那么建立这个文件夹
nslog(@"first run");nsstring*path=[nshomedirectory()stringbyappendingpathcomponent:@"documents"];nsstring*directrypath=[path stringbyappendingpathcomponent:@"imageviews"];[filemanager createdirectoryatpath:directrypath withintermediatedirectories:yes attributes:nil error:nil];nsstring*filepath=[directrypath stringbyappendingpathcomponent:@"test.pl**t"];nslog(@"%",filepath);[filemanager createfileatpath:filepath contents:nil attributes:nil];}
此段代码创建的filepath为
users/yuqiu/library/application support/iphone simulator/6.1/applications/2a8efe9e-4cca-41d1-8a5f-1ff00a115fa3/documents/imageviews/test.pl**t
一、创建~/documents/imageviews/test.pl**t的详细步骤
1、找到docume**s目录所在的位置
nsstring*str1=nshomedirectory();str1为/users/yuqiu/library/application support/iphone simulator/6.1/applications/2a8efe9e-4cca-41d1-8a5f-1ff00a115fa3
2、加上docume**s这层目录
nsstring*path=[nshomedirectory()stringbyappendingpathcomponent:@"documents"];path为/users/yuqiu/library/application support/iphone simulator/6.1/applications/2a8efe9e-4cca-41d1-8a5f-1ff00a115fa3/documents
注意:使用的是stringbyappendingpathcomponent:方法,不需要加“/;如果用的是别的方法加的话,需要写成@"/documents".
ps:这里1、2两步可以简化为
nsarray*paths=nssearchpathforderictoriesindomains(nsdocumentdirectory,nsuserdomainmask,yes);nsstring*path=[paths lastobject];3、在docume**s目录中创建名为imageviews的目录
nsfilemanager*filemanager=[nsfilemanager defaultmanager];nsstring*directrypath=[path stringbyappendingpathcomponent:@"imageviews"];[filemanager createdirectoryatpath:directrypath withintermediatedirectories:yes attributes:nil error:nil];创建nsfilemanager的实例filemanager.nsfilemanager这个类是专门进行文件管理的,可以创建文件,目录,遍历目录等。我们调用了 createdirectoryatpath:方法创建了一个新目录。4、在imageviews目录里,创建文件test.pl**t.
nsstring*filepath=[directrypath stringbyappendingpathcomponent:@"test.pl**t"];[filemanager createfileatpath:filepath contents:nil attributes:nil];调用createfileatpath:创建文件
最后得到的整个文件路径为:
二、nsfilemanager常用的文件管理操作
1、创建目录 createdirectoryatpath:
2、创建文件 createfileatpath:
3、删除某个文件 removeitematpath:
4、检查某个文件是否存在 fileex**tsatpath:
5、检查文件是否可读 **readablefileatpath:
是否可写:**writablefileatpath:
6、取得文件属性 fileattributesatpath:
改变文件属性changeattributesatpath:
7、从path代表的文件中读取数据:contentsatpath
8、移动文件movepath:topath:handler:
9、复制文件copypath:topath:handler:
-
问 盛世三国什么颜色装备最好?
提问时间:2024-05-02 12:33:25
答 目前盛世三国最好的装备是橙色的,正常打副本或者boss获得的装备一般是黄色或者绿色,黄色装备可以通过用锻造石锻造成为绿色卓越的,60级以上卓越的绿色装备星数达到...
-
问 奇迹世界卓越装备是什么颜色的?
提问时间:2024-05-02 14:25:48
答 展开全部+12是黄色的 身上放出一身**http://sun.the9.com/topic/equips/gold.h
-
问 七日杀物品什么颜色的最差到什么颜色的最好。
提问时间:2024-05-02 07:24:49
答 从差到好依次是白色,橙色,黄色,绿色,蓝色,紫色,七彩虹知道不,就按照这个来,你就知道了!紫色的会比电钻和电锯强!
-
问 神魔**怎么分装备品级什么颜色好的什么颜色坏的
提问时间:2024-05-02 16:19:35
答 品色为,白,绿,蓝,紫 紫色最好。同品级的装备看属性。一般套装是同品级里最好的(仅限于蓝色套装)其次就看同品级里的装备属性了。有的初始给两个附加属性,两条附加属...
-
问 我的世界里村民衣服的不同颜色代表了什么,有什么用
提问时间:2024-05-02 17:25:47
答 展开全部绿色长袍的是僵尸村民。注意:绿色的“标准”村民不会自然产生。当僵尸生成时,有二十分之一的几率生成僵尸村民。会出现在昏暗的地方,向**蹒跚前进并试图接触以...
-
问 我的世界怎么让武器的名字变颜色
提问时间:2024-05-02 18:05:37
答 如果是使用铁砧是不能够直接实现物品名称的特效字符修改的,唯一的办法只能通过服务器的部分插件或者直接使用背包编辑器进行修改(前提是你必须要拥有指定的权限或op权限...