Cocoa - How to connect view's delegate to file's owner in storyboard mode?

后端 未结 2 776
傲寒
傲寒 2021-02-19 10:23

When I use an .xib, I connect a view\'s delegate to the File\'s Owner via interface builder, then go into the view controller\'s .h file and set it as the delegate to complete t

2条回答
  •  别跟我提以往
    2021-02-19 11:10

    In nibs earlier, typically the file's owner was just the view controller that loaded its view from that nib.

    Now with storyboards, the view controller that implements a particular scene is included with the scene itself. You can see it in the bar below the scene (see pic)

    So where you made connections to the file's owner before, now you make them directly to the view controller. Don't forget to set the class of that view controller object to the correct class.

    enter image description here

提交回复
热议问题