jeudi 29 janvier 2015

Using Gesture Recognizers

Before you respond, keep in mind I am very new to swift (last time I coded was 2 years ago and that was OBJC), and I seem to be having an error. Here's a sample of my code:



init(sourceView:UIView, menuItems:Array<String>) {
originView = sourceView
sideBarTableViewController.tableData = menuItems

animator = UIDynamicAnimator(referenceView: originView)
let showGestureRecognizer:UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: "handleSwipe:")
showGestureRecognizer.direction = UISwipeGestureRecognizerDirection.Right
originView.addGestureRecognizer(showGestureRecognizer)
let hideGestureRecognizer:UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: "handleSwipe:")
}


I seem to be having errors with the UISwipeGestureRecognizer target. I can't set it to self, because it gives me this error: 'self' used before super.init call.


Any help is very much appreciated.




Aucun commentaire:

Enregistrer un commentaire