Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Basic question: can't drag to create button actions in XCode 5.0.1

Hello,


I have a super basic beginner question. I'm trying to add actions to buttons via dragging from the buttons onto code displayed in the assistant editor. However, the dragging process isn't generating any code (see screenshot below). I'm not sure why. I've tried dragging everything I can find onto every other thing I can find, but nothing has had any results (positive or negative). I want a an action for the "ButtonTouch" method, so I've tried dragging from the plus sign that shows up next to that method in the rightmost panel of XCode. No results there either.


Any help is apprieciated. I can't figure out what I need to drag where to create actions for my buttons. All the help that I could find online was for previous versions of XCode that involve .xib files.


Thanks in advace,

Adrian

AdrianUser uploaded file

Posted on Nov 11, 2013 10:36 AM

Reply
14 replies

Nov 11, 2013 11:56 AM in response to disguise

That definitely makes sense. However, the results are the same after the change. Control+drag does nothing to interact with the code.


I'm trying to drag to functions in the .m file for the view controller containing this view. Could it be that the functions are in the wrong place? I've tried putting them (and their declarations) in the AppDelegate.m (and .h) files, but no drag and drop response there either.

Nov 23, 2014 5:37 AM in response to parameter_poem

I'm new to iOS development and I'm working on my first project. I was facing the exact same issue on Xcode 6 and after changing the Class name to an existing Class on the "Custom Class" section inside the Identity Inpector (this is on the top right side of the right Xcode navigation pane).


Initially I had renamed the default Class files name for the ViewControler from ViewControler.(m/h) to CardGameViewControler.(m/h) so in the Custom Class section, it was pointing to what i believe was the original class name and not the modified one. After modifying it, i was able to ctrl drag the Button to one of my classes implementation file (.m), allowing me to insert an "Action".


After fixing this, i was able to ctrl drag into the code and the argument pop-up window appeared.


So the trick worked for me too. Thanks!

Basic question: can't drag to create button actions in XCode 5.0.1

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.