如何使用此格式從plist訪問特定的周計劃? 如果有人知道任何有關多級結構化plist的教程,請提出建議。如何訪問多級結構化Plist
下面的代碼給我存儲在plist中
-(void)ReadAppPlist
{
plistPath = [[NSBundle mainBundle] pathForResource:@"runplan" ofType:@"plist"];
NSMutableDictionary * propertyDict = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
name = [propertyDict objectForKey:@"Run - 1"];
NSLog(@"%@",name.description);
}
plist中是在下面給出的格式的整個數據。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Run - 1</key>
<dict>
<key>Level</key>
<string>Beginner</string>
<key>Category</key>
<string>5K</string>
<key>Plan</key>
<dict>
<key>Duration</key>
<string>5week</string>
<key>Week 1</key>
<dict>
<key>Day 1</key>
<string>Rest or run/walk</string>
<key>Day 2</key>
<string>2.5 km run</string>
<key>Day 3</key>
<string>Rest or run/walk</string>
<key>Day 4</key>
<string>2.5 km run</string>
<key>Day 5</key>
<string>Rest</string>
<key>Day 6</key>
<string>2.5 km run</string>
<key>Day 7</key>
<string>30 - 60 min walk</string>
</dict>
<key>Week 2</key>
<dict>
<key>Day 1</key>
<string>Rest or run/walk</string>
<key>Day 2</key>
<string>3 km run</string>
<key>Day 3</key>
<string>Rest or run/walk</string>
<key>Day 4</key>
<string>2.5 km run</string>
<key>Day 5</key>
<string>Rest</string>
<key>Day 6</key>
<string>3 km run</string>
<key>Day 7</key>
<string>35 - 60 min walk</string>
</dict>
</dict>
</dict>
我不知道如何來檢索這些數據非常和善,如果任何人知道的解決辦法... 在此先感謝,請幫助我。
*運行-1 *有*鍵級別*,一個String(字符串(*初級*)* 5K *)鍵*分類*,鍵*字典*計劃*等 – Larme
是的它具有所有的細節,如級別,類別,計劃。 –