hi, I have made a plist myself which picture is blow, image. keys are names of person and values are phone numbers. then I imported to source folder with ut8 encoding. Now I want to import these data to a uitableview but I'm unsuccessful. here is my codes:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
int index = [indexPath indexAtPosition:1];
NSString *key = [[phoneBookDic allKeys] objectAtIndex:index];
NSString *value = [phoneBookDic objectForKey:key];
cell.textLabel.text = key;
return cell;
}
- (void)viewDidLoad {
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"phoneBookO" ofType:@"plist"];
phoneBookDic = [[NSDictionary alloc]initWithContentsOfFile:filePath];
[super viewDidLoad];
}