我正在使用didSelectRowAtIndexPath:
下面的代码将一些数据从表 vc 传递到详细信息 vc,该代码工作正常。
我想要做的是也从地图callOutAccessoryControlTapped:
方法发送这些数据,但我不确定如何以这种方式发送数据。
我将如何
detailViewController.descriptionTextViewString = [[publicDataArray objectAtIndex:indexPath.row] objectForKey:@"short_description"];
使用
callOutAccessoryControlTapped
: 方法发送?
在objectAtIndex:indexPath.row
mapcallOutAccessoryControlTapped:
方法中无法识别。
这是我的didSelectRowAtIndexPath:
代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
ScrollView_ExampleViewController *detailViewController = [[ScrollView_ExampleViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
detailViewController.latStr = [[[publicDataArray objectAtIndex:indexPath.row] objectForKey:@"address"] objectForKey:@"lat"];
detailViewController.lngStr = [[[publicDataArray objectAtIndex:indexPath.row] objectForKey:@"address"] objectForKey:@"lng"];
detailViewController.addressStr = [[[publicDataArray objectAtIndex:indexPath.row] objectForKey:@"address"] objectForKey:@"address"];
detailViewController.titleStr = [[publicDataArray objectAtIndex:indexPath.row] objectForKey:@"title"];
detailViewController.mainImageUrl = [[publicDataArray objectAtIndex:indexPath.row] objectForKey:@"image"];
detailViewController.listingId = [[publicDataArray objectAtIndex:indexPath.row] objectForKey:@"id"];
detailViewController.descriptionTextViewString = [[publicDataArray objectAtIndex:indexPath.row] objectForKey:@"short_description"];
[self.navigationController pushViewController:detailViewController animated:YES];
}
这是我的地图注释calloutAccessoryControlTapped:
方法
- (void)mapView:(MKMapView *)mv annotationView:(MKAnnotationView *)pin calloutAccessoryControlTapped:(UIControl *)control {
ScrollView_ExampleViewController *detailViewController = [[ScrollView_ExampleViewController alloc] initWithNibName:@"ScrollView_ExampleViewController" bundle:nil];
MyAnnotation *theAnnotation = (MyAnnotation *) pin.annotation;
detailViewController.titleStr = theAnnotation.title;
detailViewController.addressStr = theAnnotation.subtitle;
// detailViewController.latStr = theAnnotation.latString;
// detailViewController.lngStr = theAnnotation.lngString;
// detailViewController.url = theAnnotation.theUrl;
[self.navigationController pushViewController:detailViewController animated:YES];
}