I have a google map and I've created a custom info window for my markers. I've put a couple buttons on the window, but I can't interact with them for the life of me. Here is my custom view:
class MarkerWindowView: UIView, UIGestureRecognizerDelegate {
//@IBOutlet weak var thumbNail: UIImageView!
@IBOutlet weak var userName: UILabel!
@IBOutlet weak var videoLocation: UILabel!
@IBOutlet weak var tags: UILabel!
override func awakeFromNib() {
println("awake From Nib")
self.userInteractionEnabled = true
print(self.userInteractionEnabled)
/*let recognizer = UITapGestureRecognizer(target: self, action:Selector("handleTap:"))
recognizer.delegate = self
/*for test in layer.sublayers {
println(test)
}*/*/
}
@IBAction func playVideoPressed(sender: AnyObject) {
println("play video")
}
@IBAction func markerWindowViewWasTapped(sender: UITapGestureRecognizer) {
println("playvideo")
}
/*func handleTap(recognizer: UITapGestureRecognizer) {
println("tapped")
}*/
}
and here is the method that returns the view in the view controller:
func mapView(mapView: GMSMapView!, markerInfoWindow marker: GMSMarker!) -> UIView! {
println("markeInfoWindow")
var newView = NSBundle.mainBundle().loadNibNamed("MarkerWindowView", owner: self, options: nil).first! as! MarkerWindowView
//println(newView.description)
newView.userName.text = "Kazuma"
newView.videoLocation.text = "Harvard"
newView.tags.text = "Kazuma is crazy"
//view.bringSubviewToFront(newView)
//view.insertSubview(newView, atIndex: 0)
//newView.userInteractionEnabled = true
/*for subView in self.view.subviews {
println(subView)
}*/
//view.bringSubviewToFront(newView)
return newView
}
I have tried a bunch of stuff to try to interact with this view including shifting views in the stack, moving layers etc. Has anyone had this problem before? Any idea what I'm doing wrong. The stuff I commented out is mostly me trying to hack it.