我从网络服务获得这个。我在表中显示地址。 但我必须这样做,点击每个单元格相关的纬度和经度将发送到其他viewController。 怎么办可以帮助我。
"registrationID": "5"
"emailAdd": "gautam.kumar@eyeforweb.com"
"userPassword": "7c4a8d09ca3762af61e59520943dc26494f8941b"
"orgPassword": "123456"
"Name": "Gautam Kumar"
"userStatus": "1"
"registrationDate": "1460633115"
"address": "Paschim vihar,jwalaheri"
"city": "kanpur"
"state": "Delhi"
"zip": ""
"lat": "28.6139391"
"lng": "77.2090212"
"phone1": ""
"phone2": ""
"country": "India"
"phoneAdd": "9990688436"
"timezone": "US/Hawaii"
"disclamair": "1"
}-
1: {
"id": "6"
"user_id": "5"
"address": "Delhi"
"city": "delhi"
"state": "Delhi"
"country": "India"
"lat": "28.6618976"
"lng": "77.2273958"
"adddate": "2016-09-21 07:23:10"
}-
2: {
"id": "15"
"user_id": "5"
"address": "California"
"city": "California"
"state": "California"
"country": "United States"
"lat": "36.778261"
"lng": "-119.4179324"
"adddate": "2016-09-21 11:26:13"
}-
3: {
"id": "19"
"user_id": "5"
"address": "nyc"
"city": "nyc"
"state": "New York"
"country": "United States"
"lat": "40.7028061"
"lng": "-74.01333"
"adddate": "2016-09-21 12:07:02"
}-
4: {
"id": "21"
"user_id": "5"
"address": "sdfasdfdsaf"
"city": "sdfsdfs"
"state": "Kramerville"
"country": "South Africa"
"lat": ""
"lng": ""
"adddate": "2016-09-22 05:16:32"
}
答案 0 :(得分:2)
在Viewcontroller A中
将数据保存在一个nsmutablearray(viewarrayA)中,并在tableview中显示using和didSelectRowAtIndexPath委托方法:
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
viewcontrollerB *objviewcontrollerB=[viewcontrollerB alloc]init];
objviewcontrollerB.viewArray=[viewarrayA objectatindex:indexpath.row]
}
在Viewcontroller B中
viewcontrollerB.h
@property (nonatomic, strong) NSMutableArray *viewArray;
viewcontrollerB.m
@synthesize viewArray;
在viewcontrollerB.h中创建一个数组(viewArray)并在ViewcontrollerA.m中合成,之后你必须从这个数组中的另一个视图控制器接收数据。