Why can't I create an Action in Xcode?

帅比萌擦擦* 提交于 2019-12-19 09:07:28

问题


When I follow the instructions at How do I add an action or outlet to a class in Xcode 4.3.1?, or Apple's First iOS App tutorial, there's no option for Action. There is only options for Outlet and Outlet Connections. What am I doing wrong?


回答1:


You can connect actions only to subclasses of UIControl.

You are trying to create an action from a UIView, which is not a subclass of UIControl and does not have actions.

Start the drag from the button, and not the "main view"



来源:https://stackoverflow.com/questions/15730019/why-cant-i-create-an-action-in-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!