0
我重視的事件對我的UIImageViews與UITapGestureRecognizer查找點擊了的UIImageView從UITapGestureRecognizer
override func viewDidLoad() {
super.viewDidLoad()
let cupPicture1Tap = UITapGestureRecognizer(target:self, action:Selector("imageTapped:"))
cupPicture1.userInteractionEnabled = true
cupPicture1.addGestureRecognizer(cupPicture1Tap)
let cupPicture2Tap = UITapGestureRecognizer(target:self, action:Selector("imageTapped:"))
cupPicture2.userInteractionEnabled = true
cupPicture2.addGestureRecognizer(cupPicture2Tap)
let cupPicture3Tap = UITapGestureRecognizer(target:self, action:Selector("imageTapped:"))
cupPicture3.userInteractionEnabled = true
cupPicture3.addGestureRecognizer(cupPicture3Tap)
}
func cupImageTapped(recognizer:UIPanGestureRecognizer) {
var clickedImageView: UIImageView = recognizer.view
let myPickerController = UIImagePickerController()
myPickerController.delegate = self;
myPickerController.sourceType = UIImagePickerControllerSourceType.Camera
myPickerController.allowsEditing = true
self.presentViewController(myPickerController, animated: true, completion: nil)
}
但我不能訪問的UIImageView點擊在cupImageTapped功能。我得到:「不能轉換'UIView'類型的值?'到指定的類型 '的UIImageView'」
你是不是attched點擊手勢的方法,你attatched的pangesture方法, PLZ更新你的問題 –