How to connect ViewController.swift to ViewControl

2019-01-17 10:30发布

I made a new view controller in Storyboard and made a new .Swift file that inherits UIViewController. However, my viewDidLoad() is not being called.

What do I need to do to connect my view controller in my story board to my .swift code so viewDidLoad() is called?

I see there's this: How to connect storyboard to viewcontroller

However, in a default project, FirstViewController(storyboard) doesn't have FirstViewController in that box, it is empty, yet viewDidLoad() is still called. It doesn't make sense.

1条回答
来,给爷笑一个
2楼-- · 2019-01-17 11:15
  1. Choose your ViewController in the storyboard or scene list (mine is called Circuit).
  2. Click on the Identity Inspector on the right
  3. Select Custom Class > Class > Type name of your swift file.

DONE :)

Here are these two steps on image (ugly i know)

查看更多
登录 后发表回答