User Tools

Site Tools


ios-labs-s14:class-02

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
ios-labs-s14:class-02 [2014/02/05 11:49]
mbarboi [Subclassing ViewControllers]
ios-labs-s14:class-02 [2014/02/05 11:51]
mbarboi [Subclassing ViewControllers]
Line 226: Line 226:
   -Go to File > New > File   -Go to File > New > File
   -Ensure the category is "Cocoa Touch" and the template is "​Objective-C class."​ Click "​Next"​   -Ensure the category is "Cocoa Touch" and the template is "​Objective-C class."​ Click "​Next"​
-  -Enter "HomeViewController" in the class field and ensure that "​subclass of" is UIViewController. Click next and then create.+  -Enter "SettingsViewController" in the class field and ensure that "​subclass of" is UIViewController. Click next and then create.
  
 {{ ios-labs-s14:​2_7.png }} {{ ios-labs-s14:​2_7.png }}
Line 238: Line 238:
 Note the new source code files visible in the project navigator. Each time you create a view controller the source code files are added to the existing project. One  step separates us from actually using the view controllers,​ however. We must let InterfaceBuilder know that the view controllers placed in the storyboard are the subclasses we just created. Without an explicit assignment InterfaceBuilder cannot tell which new class should be associated with which view controller. Note the new source code files visible in the project navigator. Each time you create a view controller the source code files are added to the existing project. One  step separates us from actually using the view controllers,​ however. We must let InterfaceBuilder know that the view controllers placed in the storyboard are the subclasses we just created. Without an explicit assignment InterfaceBuilder cannot tell which new class should be associated with which view controller.
  
 +Note: when clicking on the body of a ViewController,​ Xcode thinks you want to click on the ViewController'​s views; notice that whatever is highlighted blue is what is currently selected. To select an entire controller, click right at the very top of the rectangle in your storyboard: this is the status bar, and always refers to the controller below it. 
  
 ===Change View Controller Classes=== ===Change View Controller Classes===
ios-labs-s14/class-02.txt ยท Last modified: 2014/02/05 11:52 by mbarboi