问题
In the middle of my creating the app, xcode quit allowing me to ctrl-drag UIButtons to VCs for creating IBActions. This happens on every VC (nine in all). It does allow for creating Outlets, though. (Pls see image -> no Action selection is showing)
xcode Version 7.2 (7C68) build target is ios9.
Is there a way to fix this?
回答1:
Some things to try:
Make sure you are using one of the "Sent Events" to create the IBAction - not a Triggered Segue (that will do what you are describing) or other connection.
Try connecting not just via Ctr-drag, but via the right click menu or connections menu.
Try adding the code:
@IBAction func myAction()
{ }
... a clear circle should appear, which can be connected via dragging to the button in IB. This will create a Touch Up Inside event.
Finally, restart your project and try again.
来源:https://stackoverflow.com/questions/35058462/cant-create-ibaction-ctrl-dragging-uibutton-to-viewcontroller-xcode-version-7