iphone - How to send data to a detail vc from callOutAccessoryControlTapped: method -
i'm using didselectrowatindexpath: pass data table vc detail vc using code below works fine.
what i'm trying send data map calloutaccessorycontroltapped: method unsure how send data way.
how send
detailviewcontroller.descriptiontextviewstring = [[publicdataarray objectatindex:indexpath.row] objectforkey:@"short_description"];
using the
calloutaccessorycontroltapped: method?
the objectatindex:indexpath.row unrecognized within map calloutaccessorycontroltapped: method.
here's didselectrowatindexpath: code:
- (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]; } here's map annotation calloutaccessorycontroltapped: method
- (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]; }
you can use following method tableview's selected index:
nsindexpath *selectedindexpath = [tableview indexpathforselectedrow];
Comments
Post a Comment