Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Argument of '#selector' does not refer to an '@objc' method, property, or initializer

I sublcassed in Swift 3 a UIButton subclass that is written in Objective-C.

When I try to add a target, it fails with an error code:

class ActionButton: JTImageButton {      func action() {      }      func configure()) {         // ...         self.addTarget(self, action: #selector(self.action()), for: .touchUpInside)         // error:          // Argument of '#selector' does not refer to an '@objc' method, property, or initializer      } } 
like image 795
MJQZ1347 Avatar asked Jan 06 '17 18:01

MJQZ1347


People also ask

What is an argument of a complex number z =- i 1 i?

Detailed Solution The argument of z is the angle between the positive real axis and the line joining the point to the origin. Calculations: Given , the complex number z = (-1 - i). ⇒ z = -1 - i = x + iy. ⇒ x = -1 and y = -1.

How do you find arg z?

The argument of z is arg z = θ = arctan (y x ) . Note: When calculating θ you must take account of the quadrant in which z lies - if in doubt draw an Argand diagram. The principle value of the argument is denoted by Arg z, and is the unique value of arg z such that -π < arg z ≤ π.

What do you mean by argument of complex number?

The argument of a complex number is defined as the angle inclined from the real axis in the direction of the complex number represented on the complex plane. It is denoted by “θ” or “φ”. It is measured in the standard unit called “radians”. In this diagram, the complex number is denoted by the point P.


1 Answers

The problem is that in #selector(self.action()), self.action() is a method call. You don't want to call the method; you want to name the method. Say #selector(action) instead: lose the parentheses, plus there's no need for the self.

like image 190
matt Avatar answered Sep 16 '22 16:09

matt