Unable to connect IBOutlet from storyboard to UIView subclass

前端 未结 9 768
旧巷少年郎
旧巷少年郎 2020-12-05 10:11

I am able to right-click and drag from my custom UIView subclass file to the storyboard elements to connect them, but unable to do so the other way around. I believe this is

相关标签:
9条回答
  • 2020-12-05 10:46

    I've resolved my issue by following process.

    1. Connect your Storyboard view with any other ViewController.
    2. Now, reconnect your desired ViewController with storyboard.

    Hope this will work for you!!

    0 讨论(0)
  • 2020-12-05 10:47

    Its basic, but easy to overlook. Make sure the view controller you are dragging the outlet to is labeled as the custom class you created.

    0 讨论(0)
  • 2020-12-05 10:50

    We see this issue sometimes too since Xcode 8, and assume this is a Xcode bug.

    As a workaround:

    • Write the outlet in code @IBOutlet weak var myUiElement: UIView!

    • Ctrl + Drag from your outlet to the UI element in the Storyboard

    0 讨论(0)
提交回复
热议问题