Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ctrl-Drag from button to method not working. Xcode/Interface Builder

I am building an iOS app and i have most of the code/GUI built (its a single view app). Now i have the .xib and controller.h file next to each other and I want to associate a button click with a certain action. Everytime I try nothing happens. The UI indictor that I am dragging shows up but it wont let me connect to the method. This happens for all the objects/methods.

I have an almost identical project that works just fine too!

like image 642
Dreken105 Avatar asked Feb 02 '12 01:02

Dreken105


1 Answers

Select your XIB file and then select "Files Owner" which is the yellow cube. In the Utilities Sidebar, select the Icon with the circle and arrow inside of it (which is the "Connections Inspector"). You can then Control + Drag your to your button.

//// Edit ////

After investigating your project... Pretty sure you deleted a storyboard and then added a .xib but didn't set it's class, or link it's view as an outlet.

To do that:

  1. Select the new view (XIB), then selct the main view, and in the identity inspector, set it's class to your custom class name "AVYSViewController."

  2. Switch to the connections inspector and Control + Drag the "view" outlet to the main view in your XIB.

Also, your project was looking for the MainStoryBoard.storyboard file. So get rid of that setting by selecting your project, then selecting your target, and in the "Summary" tab, delete anything in the "Main Storyboard" field.

Note: I checked to see if your project settings were valid before I deleted the storyboard setting and it returned NO errors, so beware of this problem for future projects.

like image 55
jhilgert00 Avatar answered Sep 22 '22 21:09

jhilgert00