Ethan Humphries
Ethan Humphries

Reputation: 1836

How to link a button to an action in Xcode 6?

I am trying to create a button, that when it receives the "Touch Up Inside" call, will ring a phone number. However, the action I have declared in my ViewController.h is not showing up in my Connections Inspector, so I cannot connect the code to my button. Within my ViewController.h I have written the line of code:

-(IBAction)makePhoneCall(id)sender;

And I have finished my declaration in my ViewController.m, but it still wont appear in my Connections Inspector.

Any suggestions for help would be greatly appreciated.

Upvotes: 2

Views: 6050

Answers (1)

Unheilig
Unheilig

Reputation: 16302

What you need is to go to your storyboard, click on the Utilities button on the far right.

From there click on your controller; third tab from left you will see "Custom Class", there you need to change the name to the name of the class in which you declare your method.

See picture:

enter image description here

From then on, try to connect your method again using connection inspector.

Edit:

Adding picture for selecting the view controller in storyboard:

enter image description here

Upvotes: 2

Related Questions