Robert Saunders
Robert Saunders

Reputation: 403

.target and .action for property for UIButton

I am trying to set the button an action however in the tutorial I got the info from uses a UIBarbutton which can I guess affect the code. Here's my code any help making it alright for the UIButton would help a lot.

 //The name of my button is sidebarButton
 // Set the side bar button action. When it's tapped, it'll show up the sidebar.
_sidebarButton.target = self.revealViewController;
_sidebarButton.action = @selector(revealToggle:);

The problem is the .target and .action as it is saying its not a property of UIButton. Thanks in advanced.

Upvotes: 1

Views: 513

Answers (1)

Kasaname
Kasaname

Reputation: 1501

use this :-

  [_sidebarButton addTarget:self.revealViewController action:@selector(revealToggle:) forControlEvents:UIControlEventTouchUpInside]

Upvotes: 2

Related Questions