gpt4 book ai didi

iphone - 如何从 callOutAccessoryControlTapped : method 将数据发送到详细 vc

转载 作者:行者123 更新时间:2023-11-29 03:43:03 28 4
gpt4 key购买 nike

我正在使用 didSelectRowAtIndexPath: 将一些数据从表 vc 传递到详细 vc,使用下面的代码可以正常工作。

我想做的是从 map callOutAccessoryControlTapped: 方法发送此数据,但我不确定如何以这种方式发送数据。

我该如何发送
detailViewController.descriptionTextViewString = [[publicDataArray objectAtIndex:indexPath.row] objectForKey:@"short_description"];
使用
callOutAccessoryControlTapped:方法?

map callOutAccessoryControlTapped: 方法中无法识别 objectAtIndex:indexPath.row

这是我的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];

}

这是我的 map 注释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];
}

最佳答案

可以使用以下方法获取tableView的选中索引:


NSIndexPath *selectedIndexPath = [tableView indexPathForSelectedRow];

关于iphone - 如何从 callOutAccessoryControlTapped : method 将数据发送到详细 vc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18125664/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com