Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在情节提要中制作了我的 iOS 应用程序的布局。现在我想在按钮上添加事件。我在互联网上发现很容易拖放以添加动作。
https://developer.apple.com/library/archive/referencelibrary/GettingStarted/RoadMapiOS-Legacy/chapters/RM_YourFirstApp_iOS/Articles/05_ConfiguringView.html#//apple_ref/doc/uid/TP40007514-CH7-SW4
但是当我这样做时,什么也没有发生。我和他们说的一样,但我仍然没有看到添加出口。我怎样才能做到这一点?
您必须从情节提要拖到 .h 文件中。
在故事板中,您有一个带有按钮的 UIViewController,该 UIViewController 有一个类,您必须使用右键从按钮拖动到 ViewController 所在类的 .h 中。
如果您的助手编辑器处于活动状态,则有一个类似吸烟的图标,单击它,设置为自动,然后选择 .h。