Reputation: 1865
I'm using TTCatalog and creating a TTButton using the following:
TTButton *button = [TTButton buttonWithStyle:@"toolbarButton:" title:@"click button"];
I tried adding a target and an action to that, but that doesn't work. How do I use it?
Upvotes: 0
Views: 820
Reputation: 7717
You are missing the "[".
TTButton *button = [TTButton buttonWithStyle:@"toolbarButton:" title:@"click button"];
[button setUserInteractionEnabled:YES];
[button addTarget:self action:@selector(buttonPressed:event:) forControlEvents:UIControlEventTouchUpInside];
Then just set button properties, use target/action to set an event handler. (The TTButton is just a UIEvent subclass.)
Good luck!
Upvotes: 2