Tuesday, 15 September 2015

iphone - Different callOut in annotationView -


I'm working on the map iOS6, and I found some troubles: annotation of the picture, current location and placemark below There is also a callout button in the form but I need to do the button differently, how can I do this? This means that in the current location, I need a callout button for this task and mark, callout buttons do other things in place.
Please visit this page to see the images

I do not have enough reputation for posting. Here image - I tried this code:

  - (zero) MapView: (MKMapView *) MapView annotationView: (MKAnnotationView *) Visual calloutAccessoryControlTapped: (UIControl *) control {if ( [(UIButton *) control buttonType] == UIButtonTypeDetailDisclosure {... locationSheet.cancelButtonIndex = locationSheet.numberOfButtons - 1; } Else if ([(UIButton *) Control buttonType] == UIButtonTypeInfoLight) {... locationSheet.cancelButtonIndex = locationSheet.numberOfButtons - 1; }}   

and

  - (zero) actionSheet: (UIActionSheet *) actionSheet didDismissWithButtonIndex: (NSInteger) buttonIndex {// if (buttonIndex = actionSheet .cancelButtonIndex) {if (buttonIndex == 0} {}}}   

How can I do different tasks between the two buttons in the ActionSheet? It is difficult to explain my situation, I hope all people will tell about the above version and appreciate you. Thanks for advance.

I can not go to your images - but if you have actual buttons (UIButton) and not Mk Annotation, why not specify a tag for your button (different tags for each, of course), point them to the same function, and then differentiate them by tag? Therefore (this can be used for any button not only for UIButtonTypeCustom and any UIView - all those support tags ): UIButton * firstButton = [UIButtonTypeCustom] with UIButton Button; UIButton * secondButton = [System with UIButton Button: UIButtonTypeCustom]; FirstButton.tag = 100; SecondButton.tag = 200; [First button addTarget: Self selector: @Selector (dooming :)); [Second button addTarget: Self selector: @Selector (dooming :)); - (zero) doSomething: (ID) sender {UIButton * pressed button = (UIButton *) sender; If (pressed button tag == 100) {// first button} and if (pressed button tag == 200) {// second button}

No comments:

Post a Comment