I want to use class method for selector of action of UIBarButtonItem.
The code is:
[[UIBarButtonItem alloc]
initWithTitle:@"title"
style:UIBarButtonItemStylePlain
target: self
action:@selector(method)]
When I use instance method for action, it works.
But when I use class method for action, a error happens when I tap the button.
The error message is: unrecognized selector sent to instance.
Can’t I use class method for this?
How can I set use for target, instead of self?
Please change to the following code:
here the
targetshould beselfinstead of[self class]