iphone - custom callout in Mkmapview in ios -
i have display custom view on annotation click in ios, have display 7 images, name , detail disclosure button in custom view. on click of detail disclosure button , have call new view controller. how should it?
-(mkannotationview *)mapview:(mkmapview *)mapview viewforannotation:(id <mkannotation>)annotation { // define reuse identifier. mkpinannotationview *annotationview=[[mkpinannotationview alloc] initwithannotation:annotation reuseidentifier:@"currentloc"]; annotationview.pincolor = mkpinannotationcolorgreen; annotationview.enabled = yes; annotationview.canshowcallout = yes; // adding button on annotation callout detail disclosure button// uibutton *rightbutton = [[uibutton alloc]initwithframe:cgrectmake(0.0f,0.0f,28.0f,22.0f)]; [rightbutton setimage:[uiimage imagenamed:@"rightarrow.png"] forstate:uicontrolstatenormal]; [rightbutton addtarget:self action:@selector(pressdetailbtn:) forcontrolevents:uicontroleventtouchupinside]; annotationview.rightcalloutaccessoryview = rightbutton; annotationview.image=[uiimage imagenamed:@"orangepin.png"]; annotationview.opaque = no; return annotationview; } -(void)pressdetailbtn:(id)sender { yourvc code here }
Comments
Post a Comment