Question

when I google the title of my question I get another stackoverflow question that was answered that has been really helpful and explains most of what I need to do with hard coding a button. The problem is that when it is tied to an action it resembles this...

[btnDetail setImage:[UIImage imageNamed:@"btn-detail.png"] forState:UIControlStateNormal];

Im looking to tie the button directly to an IBAction that I've already created called exitMovie so I was hoping to do something like this...

[button setAction: [IBAction.exitMovie] forState:UIControlStateNormal];

or something like that but nothing I have tried has worked. How do I do this correctly?

below is the link to the the aforementioned hardcode that I used for the most part. Can you hard code IBActions and IBOutlets, rather than drag them manually in Interface Builder?

Was it helpful?

Solution

You found it yourself in the last question:

[button addTarget:self 
               action:@selector(exitMovie:)
     forControlEvents:UIControlEventTouchUpInside];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top