Learning a bit of iOS, a basic concept to clear up, in Android or WP, we basically are accustomed to a scene with a picture of a class, the new scene when the newly created class, but in the use of iOS storyboard found, After adding a new Viewcontroller in storyboard, I don't know where to write the code to control the Viewcontroller, because the default initialization creates the app automatically with a viewcontroller.
For me, this is not clear from the beginning, like the following diagram, a new viewcontroller is established directly in the storyboard. In fact
You should manually create a new Viewcontroller class and associate the VC in storyboard to a specific VC code file
Specific as follows
is to choose a new file to create in my project
, I still choose my swift file,
The viewcontroller that I want to associate with in storyboard is the class file that I customized in Customclass in the property menu on the right. Of course, it should be in class to write the relevant code is the same as the new project when the VC class code
Import Uikit//cnblog There is no swift, will use the C format to insert the code highlighted in the place is not displayed ==! class sviewcontroller:uiviewcontroller{ override func viewdidload () { println ("view2") } }
This basically completes the operation of creating a new activity similar to that in Android.