uibutton - send object in click button in mkMapView ios -
in mapview have sum annotation annontion have button sent me view more detail on annotation
my code
myannotation *myann = (myannotation *)annotation; uibutton *disclosebutton = [uibutton buttonwithtype: uibuttontypedetaildisclosure]; [disclosebutton addtarget: self action: @selector(showinfo:) forcontrolevents: uicontroleventtouchupinside]; annotationview.rightcalloutaccessoryview = disclosebutton; uiimageview *lefticonview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:myann.image]]; uiimage *pinimage = [uiimage imagenamed:@"pointer.png"]; [annotationview setimage:pinimage]; annotationview.leftcalloutaccessoryview = lefticonview; return annotationview;
and
-(ibaction)showinfo:(id)sender { [self performseguewithidentifier:@"aa" sender:sender]; } // envoie des données vers la detail d'une mission - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([[segue identifier] isequaltostring:@"aa"]) { detailviewcontroller *detailviewcontroller = [segue destinationviewcontroller]; detailviewcontroller.detailmodal = @[@"aa",@"aaa",@"aaa"]; } }
how can send object annotation via click botton filling table detailviewcontroller.detailmodal ?
you can send data format string , split string in prepareforsegue
the code
myannotation *myann = (myannotation *)annotation; uibutton *disclosebutton = [uibutton buttonwithtype: uibuttontypedetaildisclosure]; [disclosebutton addtarget: self action: @selector(showinfo:) forcontrolevents: uicontroleventtouchupinside]; nsstring *detail = [nsstring stringwithformat:@"%@::%@::%@::%@::%@::%@::%@::%@::%@::%@::%@" ,myann.title,myann.description,myann.latitude,myann.longitude,myann.image,myann.type,myann.ville,myann.point,myann.nombredevisite,myann.nbvtotal,myann.idmission]; disclosebutton.accessibilityhint = detail; annotationview.rightcalloutaccessoryview = disclosebutton;
in function prepareforsegue
- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([[segue identifier] isequaltostring:@"aa"]) { uibutton *button = (uibutton *)sender; nsarray* infos = [button.accessibilityhint componentsseparatedbystring: @"::"]; if ([infos count] > 1) { tit = [infos objectatindex:0]; description = [infos objectatindex:1]; latitude = [infos objectatindex:2]; longitude = [infos objectatindex:3]; image = [infos objectatindex:4]; type = [infos objectatindex:5]; ville = [infos objectatindex:6]; point = [infos objectatindex:7]; nombredevisite = [infos objectatindex:8]; nbvtotal = [infos objectatindex:9]; idmission = [infos objectatindex:10]; } detailviewcontroller *detailviewcontroller = [segue destinationviewcontroller]; detailviewcontroller.detailmodal = @[tit,description,latitude,longitude,image,type,ville,point,nombredevisite,nbvtotal,idmission]; } }
Comments
Post a Comment