title: Calling the custom annotation class into viewForAnnotation
body: <p>How do i call the CustomAnnotation class into the viewforannotation? As it looks now, it will just crash, when tapping the annotation. </p>
  
  <pre><code>class CustomAnnotation: MKPinAnnotationView, MKMapViewDelegate, CLLocationManagerDelegate {
  
  var annotationData : [Apartments] = []
  
  var fishAnnoTitle : String!
  var fishAnnoImage : NSData!
  
  let selectedLabel : UILabel = UILabel.init(frame:CGRectMake(0, 0, 300, 38))
  let selectedImage : UIImageView = UIImageView.init(frame:CGRectMake(0, 35, 300, 200))
  
  var selectedButton: UIButton = UIButton(type: UIButtonType.Custom) as UIButton!
  
  override func setSelected(selected: Bool, animated: Bool)
  {
      super.setSelected(false, animated: animated)
  
      if(selected)
      {
  
          selectedLabel.textAlignment = .Center
          selectedLabel.textColor = UIColor.darkGrayColor()
          selectedLabel.font = UIFont.init(name: "Trebuchet MS", size: 20)
          selectedLabel.backgroundColor = UIColor.whiteColor()
          selectedLabel.layer.borderColor = UIColor.darkGrayColor().CGColor
          selectedLabel.layer.borderWidth = 2
          selectedLabel.layer.cornerRadius = 5
          selectedLabel.layer.masksToBounds = true
  
          selectedImage.layer.cornerRadius = 5
          selectedImage.layer.borderWidth = 2
          selectedImage.layer.masksToBounds = true
  
          selectedButton.frame = CGRectMake(262, 0, 38, 38)
          selectedButton.layer.borderColor = UIColor.darkGrayColor().CGColor
          selectedButton.setImage(UIImage(named: "advance.png"), forState: .Normal)
          selectedButton.addTarget(self, action: "buttonPressed", forControlEvents: UIControlEvents.TouchUpInside)
  
          let appDel: AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
          let context: NSManagedObjectContext = appDel.managedObjectContext
          let freq = NSFetchRequest(entityName: "Apartments")
          let fetchResults = try! context.executeFetchRequest(freq) as! [Apartments]
  
          self.annotationData = fetchResults
          let countImages = self.annotationData.count
  
          if countImages != 0 {
              for row in 0...countImages-1 {
                  let dataImage : Apartments = self.annotationData[row]
                  self.fishAnnoImage = (dataImage.valueForKey("lejlighedBillede") as? NSData)!
                  self.fishAnnoTitle = "\(dataImage.valueForKey("lejlighedHusleje")!)"
  
                  selectedImage.image = UIImage(data: dataImage.lejlighedBillede!)
                  self.addSubview(selectedImage)
  
                  selectedLabel.text = self.fishAnnoTitle!
                  self.addSubview(selectedLabel)
  
                  self.addSubview(selectedButton)
  
              }
          }
  
      }
      else
      {
          selectedLabel.removeFromSuperview()
          selectedImage.removeFromSuperview()
          selectedButton.removeFromSuperview()
      }
  }
  }
  </code></pre>
  
  <p>And now i want to use the custom class, so i can make a custom annotation.</p>
  
  <pre><code>func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -&gt; MKAnnotationView? {
  
          var annotationView = mapView.dequeueReusableAnnotationViewWithIdentifier("CustomAnnotation") as CustomAnnotation
          annotationView = CustomAnnotation(annotation: annotation, reuseIdentifier: "CustomAnnotation")
  
          return annotationView
  
  }
  </code></pre>