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 } }
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.
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 ≤ π.
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.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With