-1
我想用保存的plist遍歷plist中嵌套的NSDictionary使用SWIFT
let path = NSBundle.mainBundle().pathForResource("draw_array", ofType: "plist");
var dict = NSDictionary(contentsOfFile: path!);
var lastPoint: CGPoint!;
for (myKey,myValue) in dict {
var row = myValue as NSDictionary;
for (index, (key, value)) in enumerate(row) {
lastPoint = CGPoint(x: dict[1]!["start"]["x"] as Int?, y: dict[1]!["start"]["y"] as Int?);
println("index: \(index) key: \(key) value: \(value)")
}
}
畫點什麼
我不能讓個別x和y的值,並保持歌廳錯誤
什麼錯誤?你能提供更多信息嗎? – danielbeard 2014-10-20 20:16:40
類型'Int'不符合dict [1]中的協議'NSCopying'![「start」] – Ben 2014-10-20 21:16:33