title: Swift - setting rounded corners to annotation view image
body: <p>Here is my previous thread, where I set image to annotation view pins</p>
  
  <p><a href="https://stackoverflow.com/questions/28033159/swift-setting-different-images-from-array-to-annotation-pins/28033880#28033880">Swift - setting different images from array to annotation pins</a></p>
  
  <p>Right now I encountered a problem with setting rounded corners on annotation view image. </p>
  
  <pre><code>cannot show callout with clipsToBounds enabled swift
  </code></pre>
  
  <p>appears that I have to choose between rounded corners or showing callout, I don't really get why these two can't come along. Is there any way to do that? 
  Here is my viewForAnnotation function:</p>
  
  <pre><code>    func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -&gt; MKAnnotationView! {
      if !(annotation is RestaurantAnnotation) {
          return nil
      }
  
      let reuseId = "restaurant"
      var anView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId)
      if anView == nil {
          anView = MKAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
          anView.canShowCallout = false
      }
      else {
          anView.annotation = annotation
  
      }
  
      let restaurantAnnotation = annotation as RestaurantAnnotation
  
      if (restaurantAnnotation.image != nil) {
  
                          anView.image = restaurantAnnotation.image!
  
                          anView.layer.masksToBounds = true
  
                          anView.layer.cornerRadius = (anView.frame.size.height)/10.0
  
      }
      else {
          // Perhaps set some default image
      }
  
      return anView
  }
  </code></pre>
  
  <p>Thanks in advance for any help!</p>