iOS开发之file列表查看

移动开发 iOS
本文为大家介绍了iOS开发中的file列表查看,新手所写的程序分享给大家,希望对51CTO的各位网友有所帮助,如果有什么意见欢迎交流。

哈哈,我是新手,下面为大家介绍一下在iOS开发中的如何实现file列表查看。

查看根目录下的文件列表

  1. NSArray *leveList= 
  2.  [[[NSFileManager alloc]init] contentsOfDirectoryAtPath: [NSHomeDirectory() stringByAppendingPathComponent:@""]                                                                          error:nil]; 
  3.   for (NSString *str in leveList) { 
  4.      NSLog(@"levelList:%@",str); 
  5.  } 
  6.  NSLog(@"count:%d",[leveList count] ); 

文件列表结果如下:

  1. 2013-06-14 16:18:14.513 helloword[853:c07] levelList:Documents 
  2. 2013-06-14 16:18:14.533 helloword[853:c07] levelList:helloword.app 
  3. 2013-06-14 16:18:14.534 helloword[853:c07] levelList:Library 
  4. 2013-06-14 16:18:14.535 helloword[853:c07] levelList:tmp 
  5. 2013-06-14 16:18:14.537 helloword[853:c07] count:4 

查看Library文件列表

  1.         NSArray *leveList= 
  2.       [[[NSFileManager alloc]init] contentsOfDirectoryAtPath: [NSHomeDirectory() stringByAppendingPathComponent:@"Library"]                                                                          error:nil]; 
  3. for (NSString *str in leveList) { 
  4.           NSLog(@"Library:%@",str); 
  5.       } 
  6.       NSLog(@"count:%d",[leveList count] ); 

结果如下:

  1. 2013-06-14 16:26:49.475 helloword[1040:c07] Library:Caches 
  2. 2013-06-14 16:26:49.478 helloword[1040:c07] Library:Preferences 
  3. 2013-06-14 16:26:49.480 helloword[1040:c07] count:2 

 

责任编辑:闫佳明 来源: apkbus
相关推荐

2014-07-23 13:17:53

iOSUITextField

2014-07-21 14:49:35

iOSUILabel

2013-04-12 15:53:39

2017-02-15 09:25:36

iOS开发MQTT

2011-08-02 11:07:42

iOS开发 UIWebView

2011-08-11 16:50:04

iOSTwitter

2013-07-25 15:15:26

iOS开发学习iOS全局变量

2014-08-08 10:12:44

IRC

2013-07-25 15:19:23

iOS开发学习Xcode打包framiOS开发

2014-04-08 17:35:24

iOS 7弹簧式列表

2013-04-11 16:08:50

iOS开发技巧积累

2012-01-18 13:46:37

ARCiOS

2013-07-23 07:34:54

iOS开发学习适配iphone5

2011-08-02 11:30:41

iOS开发 邮件发送

2011-08-02 09:22:41

iOS iPhone

2013-07-29 05:01:31

iOS开发iOS开发学习按钮拖动和点击

2013-07-24 16:47:23

iOS开发学习iOS协议代理传值

2013-12-17 11:04:10

iOS开发传感器

2017-12-25 14:59:47

APP架构iOS协议

2014-08-04 17:46:15

NavBarTarBar
点赞
收藏

51CTO技术栈公众号