Adding a View Controller in Xcode?

2019-09-13 08:19发布

问题:

I have created the initial view for my application. This initial view contains segues to new screens/view controllers that I threw together in the Xcode storyboard.

I set audio controls, and background paramaters to my applications initial view using the standard Viewcontroller.h and Viewcontroller.m files that load out when Xcode starts.

My question: how do I programmatically access new viewcontrollers? I.e. 'make a new target' or 'click and drag in interface builder' or something...

回答1:

Lets say your viewcontroller is called newViewController,

1.drag and drop a view controller

  1. click on the VC.

3.add the name of it in your interface builder under "custom class" and your .h and .m files will both be connected.