我创建了一个 XIB 文件,xib 文件中有一个 NavigationController,NavigationController 中有一个 UIViewController。然后我将一个按钮拖到 UIViewController 中。我想连接按钮和 UIViewController 但我不能。我只能从按钮拖一条线到 navigationController,而按钮不响应 NavigationController 中的操作。我不知道为什么。
谁能告诉我为什么?我想知道为什么我无法连接按钮和我的 UIViewController(只能连接到 NavigationController)。如何让按钮起作用?
最佳答案
我遇到过类似的问题。你有几个选择。
First you can find the button (or label in my case) on the left side of the storyboard and you can right click then drag to the code in the assistant editor
You could go into the assistant editor where the Action or Outlet is, find the circle next to it, left click and drag to the button or label in the list view that I showed before.
And the other option is to find the item you want to link in the storyboard and select it. Then select the 'Selections Inspector on the top right. In there you can click and drag from the circle and see everything that is connected. You can also see EVERYTHING in the VC if you select the ViewController in the story board and look at the Selections Inspector.
关于ios - UIButton 在 NavigationController 中没有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48981133/