当我在显示的地图上单击DetailDisclosure时,我想切换视图。我当前的代码如下:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view
calloutAccessoryControlTapped:(UIControl *)control
{
DetailViewController *detailViewController = [[DetailViewController alloc]
initWithNibName:@"DetailViewController" bundle:nil];
detailViewController.title = dictionary[@"placeLatitude"]
[self.navigationController pushViewController:detailViewController animated:YES];
}
我可以使用它推送到视图控制器,但是我还没有弄清楚如何强制它从用于生成地图的JSON数组中提取细节。我正在拉这样的数据来生成地图:
for (NSDictionary *dictionary in array)
{
// retrieve latitude and longitude from the dictionary entry
location.latitude = [dictionary[@"placeLatitude"] doubleValue];
location.longitude = [dictionary[@"placeLongitude"] doubleValue];
//CAN I LOAD THE TITLE/ID OF THE LOCATION HERE?
我知道我有点偏离目标了。也许朝正确的方向踢会有所帮助。谢谢!