上一页 1 ··· 13 14 15 16 17
摘要: NSString *path = NSHomeDirectory();上面的代码得到的是应用程序目录的路径,在该目录下有三个文件夹:Documents、Library、temp以及一个.app包!该目录下就是应用程序的沙盒,应用程序只能访问该目录下的文件夹!!!请参考下面的例子:1、NSString *path1 = NSHomeDirectory();NSLog(@"path1:%@", path1);path1:/Users/yuanjun/Library/Application Support/iPhone Simulator/4.2/Applications/172 阅读全文
posted @ 2012-04-18 15:31 高笑228 阅读(5128) 评论(0) 推荐(2)
摘要: 在iPhone开发中,使用全局变量有这么几种实现方法:1、在AppDelegate中声明并初始化全局变量 然后在需要使用该变量的地方插入如下的代码: //取得AppDelegate,在iOS中,AppDelegat被设计成了单例模式 AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; appDelegate.Your Variable2、使用 extern 关键字2.1 新建Constants.h文件(文件名根据需要自己取),用于存放全局变量;2.2 在Constants.h中写入你需要... 阅读全文
posted @ 2012-04-17 16:38 高笑228 阅读(16384) 评论(1) 推荐(0)
上一页 1 ··· 13 14 15 16 17