[iPhone] plistから値を取得する方法

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% [?]

DiggGoogle BookmarksGoogle ReaderFacebookDeliciousFriendFeedEvernoteTwitterShare
  1. No comments yet.

  1. No trackbacks yet.