我是 iOS 编程新手,我正在研究遍历 plist。但我无法访问标签中的单个记录。也就是说,如果我只想访问“Amul”的详细信息,那么在 if 条件中写什么
下面是我的 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">
<array>
<dict>
<key>Email Address</key>
<string>ams@asd.com</string>
<key>Name</key>
<string>Amul</string>
<key>Phone Number</key>
<string>984756393</string>
</dict>
<dict>
<key>Email Address</key>
<string>cat@se.com</string>
<key>Name</key>
<string>Anoop</string>
<key>Phone Number</key>
<string>87453726</string>
</dict>
<dict>
<key>Email Address</key>
<string>per@se.com</string>
<key>Name</key>
<string>Bhagesss</string>
<key>Phone Number</key>
<string>7684947</string>
</dict>
</array>
</plist>
也正在读取数组中的所有数据,如下所示
NSArray *array=[[NSArray alloc]initWithContentsOfFile:filePath];
if (i<[array count]) {
NSLog(@"%@", [array objectAtIndex:i]);
NSString *strName=[[NSString alloc]initWithFormat:@"%@",[array
valueForKey:@"Name"]];
NSString *strPhone=[[NSString alloc]initWithFormat:@"%@",[array
valueForKey:@"Phone Number"]];
NSString *strEmail=[[NSString alloc]initWithFormat:@"%@",[array
valueForKey:@"Email Address"]];
lblName.text=strName;
lblPhone.text=strPhone;
lblEmail.text=strEmail;
i++;
}
现在我应该提出什么条件,以便只显示我在文本字段中提供的名称的记录。请帮忙...