यह तेजी से 3 में क्यों काम नहीं करता है?स्विफ्ट 3 में चयनकर्ता
: यह कह रनटाइम पर दुर्घटनाओं '- [my_app_name.displayOtherAppsCtrl नल:]: गैर मान्यता प्राप्त चयनकर्ता उदाहरण 0x17eceb70 के लिए भेजा'
override func viewDidLoad() {
super.viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Register cell classes
//self.collectionView!.register(ImageCell.self, forCellWithReuseIdentifier: reuseIdentifier)
// Do any additional setup after loading the view.
let lpgr = UITapGestureRecognizer(target: self, action: Selector("tap:"))
lpgr.delegate = self
collectionView?.addGestureRecognizer(lpgr)
}
func tap(gestureReconizer: UITapGestureRecognizer) {
if gestureReconizer.state != UIGestureRecognizerState.ended {
return
}
let p = gestureReconizer.location(in: self.collectionView)
let indexPath = self.collectionView?.indexPathForItem(at: p)
if let index = indexPath {
//var cell = self.collectionView?.cellForItem(at: index)
// do stuff with your cell, for example print the indexPath
print(index.row)
} else {
print("Could not find index path")
}
}
आपने 'चयनकर्ता (" टैप: ") लिखा है '। आपको चेतावनी मिली आपने इसे अनदेखा किया। तुम दुर्घटनाग्रस्त हो गए – matt