         }
     }
     
-    override public func touchesEnded(touches:Set<NSObject>, withEvent event:UIEvent) {
-        if event.touchesForView(view)?.count > 0 {
+    override public func touchesEnded(touches:Set<UITouch>, withEvent event:UIEvent?) {
+        if event?.touchesForView(view)?.count > 0 {
             view.endEditing(true)
         }
     }

            ctrl.sendAction(btn.selector, to:btn.target, forEvent:nil)
            return
        } else {
            println("Unknow action type for button")
        }
        hideView()
    }

        btn.target = target
        btn.selector = selector
        btn.addTarget(self, action:Selector("buttonTapped:"), forControlEvents:.TouchUpInside)
        btn.addTarget(self, action:Selector("buttonTapDown:"), forControlEvents:[.TouchDown, .TouchDragEnter])
        btn.addTarget(self, action:Selector("buttonRelease:"), forControlEvents:[.TouchUpInside, .TouchUpOutside, .TouchCancel, .TouchDragOutside] )
        return btn
    }

