0

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?

Community
  • 1
  • 1
Pkolms
  • 7
  • 3

1 Answers1

1

You found it yourself in the last question:

[button addTarget:self 
               action:@selector(exitMovie:)
     forControlEvents:UIControlEventTouchUpInside];
Ahab
  • 311
  • 1
  • 2
  • 6
  • That got rid of all errors but when I run it and attempt to press that button I get a signal SIGABRT that states: – Pkolms Jul 06 '12 at 20:30
  • Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController exitMovie:]: unrecognized selector sent to instance 0xf244410' – Pkolms Jul 06 '12 at 20:31
  • I take this to mean that I need to implement the method exitMovie inside of ViewController but Im pretty sure I did. How exactly does it want me to implement exitMovie in case I'm doing it wrong? I just initialized exitMovie in the .h and implemented it in the .m. Is there something more I'm suppose to do? – Pkolms Jul 06 '12 at 23:56