plist其實是一個xml文件
首先我們需要讀取制定的文件
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@“myOlders” ofType:@“plist”];
然後我們就可以從中讀取相應的數據,這裏我們數據的最外邊是一個數組,這樣我們從指定的路徑中就可以獲取相應的數據。
NSArray *all Older s =[[NSArray alloc] initWithContentsOffile:plistPath];
關於數據字典,例如:
NSDictionary *tmpInfo = [dictionary objectForKey: @”Student”];
self.stuName.text = [NSString stringWithFormat:@”%@”, [tmpInfo objectForKey: @”Name”]];
self.stuSex.text = [NSString stringWithFormat:@”%@”, [tmpInfo objectForKey: @”Sex”]];
self.stuNum.text = [NSString stringWithFormat:@”%@”, [tmpInfo objectForKey: @”Num”]];
通過制定的名字找到對應的數據。