You do not provide enough information about you proceeded.
Did you do those steps ?
create a tapGesture in storyboard by dragging the object in the viewController structure ?
-> Could you show the attributes inspector of the tapGesture ?
you control dragged in storyboard from the tapGesture to the label object in the viewController structure (in storyboard)?
-> Do you see the tapGesture listed Connections inspector of the label?
You say:
When I connect the outlet to the gesture recogniser I get this error:
How exactly do you try to connect ? Is it the label in storyboard or IBOutlet in code (you should not do it) ? Please clarify
How can I connect the tap gesture recogniser in storyboard to my code?
What do you want to connect exactly in code ? You don't have to connect the tapGesture to the label IBOutlet in code. The connection is made in storybaord as explained before.
If you want to declare an action for the tapGesture, then
create the IBAction
@IBAction func tapped(_ sender: UITapGestureRecognizer) {
}
select the tapGesture in stroryboard
corntrol-drag from the tapgesture to the IBAction
-> You should now see "tapped" in the connections inspector of the tapGesture in the sent actions section.
It seems you have tried to connect the incrementNumberOfTaps action to the cell and not to the tapGesture.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: