我正在尝试将它们从 plist 中的数组中用作表的标签。这是我到目前为止所尝试的。我已经声明了一个 ivar:NSArray *viewerKeys;
在 viewDidLoad
`NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
// get documents path
NSString *documentsPath = [paths objectAtIndex:0];
// get the path to our Data/plist file
NSString *plistPath = [documentsPath stringByAppendingPathComponent:@"Data.plist"];
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithContentsOfFile:(NSString *)plistPath];
viewerKeys = [dictionary allKeys];`
并在 cellForRowAtIndexPath
UILabel *label = (UILabel *)[cell viewWithTag:1000];
label.text = [viewerKeys objectAtIndex:indexPath.row];
我可以从 viewdidload 记录 viewerKeys,但如果我尝试NSLog@"%@", [viewerKeys objectATIndex:indexPath.row]
,我什么也得不到 - 甚至没有。