Andy
Andy

Reputation: 1865

How do I set the click method on a TTButton?

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

Answers (1)

Dave
Dave

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

Related Questions