E
E
Evgeny Klenov2020-11-22 17:31:27
iOS
Evgeny Klenov, 2020-11-22 17:31:27

When adding a gesture (addGestureRecognizer) to a view in the UIView derived class, Xcode throws an error. What's wrong?

I want to implement the delegate pattern by passing a notification from the view to the controller that the UITapGestureRecognizer has worked.
When adding a gesture (addGestureRecognizer) to a view in the UIView descendant class, Xcode gives an error:
Instance member 'addGestureRecognizer' cannot be used on type 'GesterView'

Moreover, if you add a gesture in the controller, there is no error, everything is ok.
Thanks in advance for any help!

5fba760b87318306171928.png5fba761d13bf6043136346.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
briahas, 2020-11-23
@klenovptz

I can assume, because there is no self-a. Because it is a class function

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question