I am iOS developer. I am trying to show custom callout view click on (pin).This callout view is contain two button. I have been tried to show custom callout view with these below given code.
func mapView(mapView: MKMapView!, didSelectAnnotationView view: MKAnnotationView!) {
var calloutSize:CGSize = CGSizeMake(200.0, 110.0)
confirm = MKAnnotationView(frame: CGRect(x: -calloutSize.width/2, y: -calloutSize.height - 10, width: calloutSize.width, height:calloutSize.height))
confirm!.backgroundColor = UIColor(white: 0.9, alpha: 1)
confirm!.alpha = 0.7
let button_Yes = UIButton(frame: CGRectMake(0, 0, 200, 54))
button_Yes.backgroundColor = UIColor.purpleColor()
button_Yes.setTitle("See listing detail", forState: UIControlState.Normal)
button_Yes.addTarget(self, action:Selector( "checkout:"), forControlEvents: UIControlEvents.TouchUpInside)
button_Yes.userInteractionEnabled = true
button_Yes.tag = 1
confirm!.addSubview(button_Yes)
let button_No = UIButton(frame: CGRectMake(0,calloutSize.height / 2, 200, 54))
button_No.backgroundColor = UIColor.purpleColor()
button_No.setTitle("Get directions", forState: UIControlState.Normal)
button_No.addTarget(self, action:Selector("checkin:"), forControlEvents: UIControlEvents.TouchUpInside)
button_No.userInteractionEnabled = true
button_No.tag = 2
confirm!.addSubview(button_No)
view.addSubview(confirm!)
}
func mapView(mapView: MKMapView!, didDeselectAnnotationView view: MKAnnotationView!) {
confirm!.removeFromSuperview()
}