title: SWIFT 2: multiline MKPointAnnotation
body: <p>Is there a way to create multiline annotations? </p>
  
  <p>Here is my code: </p>
  
  <p>1) My customAnnotation class</p>
  
  <pre><code>import UIKit
  import MapKit
  
  class CustomAnnotation: NSObject, MKAnnotation {
  
      var title: String?
      var subtitle: String?
      var address: String = ""
      var phoneNumber: String = ""
      var workingHours: String = ""
      var coordinate: CLLocationCoordinate2D
  
  
      init(   title: String,
              subtitle: String,
              address: String,
              phoneNumber: String,
              workingHours: String,
              coordinate: CLLocationCoordinate2D ){
  
          self.title = title
          self.subtitle = subtitle
          self.address = address
          self.phoneNumber = phoneNumber
          self.workingHours = workingHours
          self.coordinate = coordinate
  
          super.init()
      }
  }
  </code></pre>
  
  <p>2) my view controller with map: </p>
  
  <p>class MapViewController: UIViewController, MKMapViewDelegate {</p>
  
  <pre><code>@IBOutlet weak var theMapView: MKMapView!
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
  
              let latitude: CLLocationDegrees = 54.685290
              let longitude : CLLocationDegrees = 25.279661
  
              let latDelta : CLLocationDegrees = 0.2
              let lonDelta : CLLocationDegrees = 0.2
  
              let theSpan : MKCoordinateSpan = MKCoordinateSpanMake(latDelta, lonDelta)
  
              let branchLocation : CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude, longitude)
  
              let theRegion : MKCoordinateRegion = MKCoordinateRegionMake(branchLocation, theSpan)
  
  
              let annotation = CustomAnnotation(title: "Brach1", subtitle: "some text for B1", address: "address str 12-12", phoneNumber: "123 321 123", workingHours: "00 - 24", coordinate: branchLocation)
  
  
              self.theMapView.setRegion(theRegion, animated: true)
  
              self.theMapView.addAnnotation(annotation)
  
          }
  
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
  
  }
  
  
  func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -&gt; MKAnnotationView? {
  
      let identifier = "MyPin"
  
      if annotation.isKindOfClass(MKUserLocation) {
          return nil
      }
  
      var annotationView: MKPinAnnotationView? = mapView.dequeueReusableAnnotationViewWithIdentifier(identifier) as? MKPinAnnotationView
  
      if annotationView == nil {
  
          annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: identifier)
          annotationView?.canShowCallout = true
  
          let multiLineView = UIView(frame: CGRectMake(0, 0, 100, 40))
  
          let label1 = UILabel(frame: CGRectMake(0,0,100,20))
          label1.text = "Some text1"
          multiLineView.addSubview(label1)
  
          let label2 = UILabel(frame: CGRectMake(0,20,100,20))
          label2.text = "some text2"
          multiLineView.addSubview(label2)
  
          annotationView!.rightCalloutAccessoryView = multiLineView
  
      } else {
          annotationView!.annotation = annotation
      }
  return annotationView
  }
  </code></pre>
  
  <p>}</p>
  
  <p>What I get: </p>
  
  <p><a href="https://i.stack.imgur.com/unZ76.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/unZ76.png" alt="enter image description here"></a></p>
  
  <p>If I would use  </p>
  
  <pre><code>annotationView!.leftCalloutAccessoryView = multiLineView
  </code></pre>
  
  <p>I would get: </p>
  
  <p><a href="https://i.stack.imgur.com/hgkSf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hgkSf.png" alt="enter image description here"></a></p>
  
  <p>I haven't found any other methods. I would expect something like bottomCalouttAccessoryView to get something like: </p>
  
  <p><a href="https://i.stack.imgur.com/oUuk6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oUuk6.png" alt="enter image description here"></a></p>
  
  <p>That is very wired for me that the height of annotation is not amendable. (that is why my three lables don't even fit there)
  I was trying to play with autoresize methods of annotationview but with no luck:(</p>