[iPhone] plistから値を取得する方法
- May 14th, 2010
- Posted in iPhone
- Write comment
plistの追加方法。
Resoucesを選択中にCommand + Nで新規ファイルを作成する。
この時、Reesouces -> Property List を選択。
ファイル名には必要に応じた適当な名前を付ける。
あとは、これをプログラム中で呼び出すには、下記のようにする。
# hogehoge が保存したファイル名
NSString *settingPath = [[NSBundle mainBundle] pathForResource:@"hogehoge" ofType:@"plist"]; NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:settingPath]; NSLog(@"%@", dict);
Popularity: 40% [?]
No comments yet.