在iPhone/iPad工程里面,添加 File->Other->Property List,例如取名: www.opensoce.com.plist,然后在其中添加3個项目(Key) Name, Date, Dept,并填充Value值。
以下为对此www.opensoce.com.plist文件的一系列常用操作(myname,mydate,mydept为定义的变量):
[php]NSString *path=[[NSBundle mainBundle] pathForResource:@"www.opensoce.com" ofType:@"plist"];
//从文件内容创建字典
NSDictionary *dict=[NSDictionary dictionaryWithContentsOfFile:path];
//从字典取出Key对应的Value
self.myname.text=[dict valueForKey:@"Name"] ;
NSLog(@"%@",[dict valueForKey:@"Name"]);
self.mydate.text=[dict valueForKey:@"Date"] ;
self.mydept.text=[dict valueForKey:@"Dept"] ;
//改变Key对应的值
[dict setValue:@"Jimmy" forKey:@"Name"];
//将改变后的结果(字典)写入文件(filepath指定路径和文件名)
[dict writeToFile:filepath atomically:YES];[/php]
NumberInput_IMKit_Sample
http://developer.apple.com/library/mac/#samplecode/NumberInput_IMKit_Sample/Introduction/Intro.html
请教:
如何运行苹果公司提供的输入法例子
管理员 聖騎天下 : 2012年08月15日13:37:38 地下1层
好,有空时看看...