teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

修正

2016/06/25 13:24

投稿

_Kentarou
_Kentarou

スコア8490

answer CHANGED
@@ -1,4 +1,22 @@
1
- Bundleとして追加している場合は以下になります。
1
+ ## Bundleから読み込む場合
2
2
 
3
3
  ![image](c9ebbe0ef91b191f1b11f2f1178a309e.png)
4
- ![image](78474e2ef4dac702309d5bf15d2e7888.png)
4
+ ![image](78474e2ef4dac702309d5bf15d2e7888.png)
5
+
6
+ ## Document Folderから読み込む場合
7
+
8
+ ```swift
9
+ import UIKit
10
+
11
+ class ViewController: UIViewController {
12
+
13
+ override func viewDidLoad() {
14
+ super.viewDidLoad()
15
+
16
+ let paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first! as NSString
17
+ let path = paths.stringByAppendingPathComponent("Dictionary.plist")
18
+ let dictionary = NSDictionary(contentsOfFile: path)
19
+ print(dictionary)
20
+ }
21
+ }
22
+ ```