当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - Getting array details and show the Contacts

问题描述:

Here i fetched the data from address book.The below format i fetched into the contacts on my phone.

[

{

"Firstname": "Kate",

"Lastname": "Bell",

"mobileNumber": "(555)564-8583",

"homeNumber": "(555) 564-8583"

},

{

"Firstname": "john",

"Lastname": "Bell",

"mobileNumber": "(555)564-8583",

"homeNumber": "(555)564-8583"

},

{

"Firstname": "anna",

"Lastname": "naik",

"mobileNumber": "(555)564-8583",

"homeNumber": "(555) 564-8583"

},

{

"Firstname": "dec",

"Lastname": "alex",

"mobileNumber": "(555)564-8583",

"homeNumber": "(555)564-8583"

},

{

"Firstname": "anna",

"Lastname": "naik",

"mobileNumber": "(555)564-8583",

"homeNumber": "(555) 564-8583"

},

{

"Firstname": "dec",

"LKateame": "alex",

"mobileNumber": "(555)564-8583",

"homeNumber": "(555) 564-8583"

}

]

here i get the Firstname data and displayed into the UITableView ,but the problem is when i tap the name on the TableView ,it will display to the anotherView.In the another View Contact name and respective numbers should be displayed.How can it's implemented .Can you please suggest me,thank you.

网友答案:

Maybe, you should create a class, Such as "People", to store the information and put them in an array.

then

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   People *people = self.peopleArray[indexPath.row];

   UIViewController *newViewController = [UIViewController alloc] init]
   newViewController.people = people;

   [self.navigationController pushViewController:newViewController animated:YES];
}

so, get what you want from the array in the new ViewController.

分享给朋友:
您可能感兴趣的文章:
随机阅读: