User Tools

Site Tools


ios-labs-s14:scratch

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
ios-labs-s14:scratch [2014/02/28 14:08]
mbarboi
ios-labs-s14:scratch [2014/02/28 14:13]
mbarboi
Line 129: Line 129:
  
 ====Creating a Child View Controller==== ====Creating a Child View Controller====
-  -Add a container to MapRoot. Have it take up the bottom half of the screen+  -Add a container ​view to MapRoot ​in IB. Have it take up the bottom half of the screen
   -Delete the stock controller included. Add a UITableViewController and set it as the embedded controller by right-clicking the container and dragging to the new controller   -Delete the stock controller included. Add a UITableViewController and set it as the embedded controller by right-clicking the container and dragging to the new controller
   -Subclass the table view controller   -Subclass the table view controller
Line 136: Line 136:
  
 ====Updating the Table==== ====Updating the Table====
-  -Create a method called "​updateTrips"​ in your subclassed controller. Call //​getTrips//​ in this method, updating an instance variable array with the contents and reloading the table+  -Create a method called "​updateTrips"​ in your subclassed ​table controller. Call //​getTrips//​ in this method, updating an instance variable array with the contents and reloading the table
   -Fill the contents of the cells with the relevant Trip properties   -Fill the contents of the cells with the relevant Trip properties
   -Register this method with NSNotificationCenter using the examples methods provided in the NSNotification page linked above   -Register this method with NSNotificationCenter using the examples methods provided in the NSNotification page linked above
Line 144: Line 144:
 ====Animating the Container In==== ====Animating the Container In====
   -Copy and change the animation methods in MapRoot to perform the same animation for the container view   -Copy and change the animation methods in MapRoot to perform the same animation for the container view
-  -Issue an NSNotification for the same key in MapRoot when the Trips button is pressed+  -Issue an NSNotification for the same key (used above in your table controller) ​in MapRoot when the Trips button is pressed
  
-The whole reason for doing this is to make sure that the iPad version functions like the iPhone version while maintaining a different layout. In these next steps you'll quickly repeat the UI steps for the iPad version.+The whole reason for doing this is to make sure that the iPad version functions like the iPhone version while maintaining a different layout. In these next steps you'll quickly repeat the UI steps for the iPad version. The MapRoot will not have buttons, those buttons will instead reside in the iPad controller. We'll route the button callbacks to MapRoot by loading a reference to it when iPad controller loads. Note that embed segues can be referenced through identifiers just like any other seguews.
  
 See the screenshot for the final iPad layout. See the screenshot for the final iPad layout.
Line 184: Line 184:
     [containerLeft addSubview:​table.view];​     [containerLeft addSubview:​table.view];​
 </​code>​ </​code>​
 +
 +The last three lines in the last code chunk are the three canonical methods needed to add a child view controller programmatically. If you are nesting controllers,​ you must call them. Containers set up in IB do this automatically.
  
 Note the identifiers and embed strings above. Set these by selecting segues and controllers respectively and  Note the identifiers and embed strings above. Set these by selecting segues and controllers respectively and 
Line 198: Line 200:
  
 Good Luck! Good Luck!
- 
-{{ ios-labs-s14:​9_1.png }} 
-{{ ios-labs-s14:​9_2.png }} 
-{{ ios-labs-s14:​9_3.png }} 
-{{ ios-labs-s14:​9_4.png }} 
-{{ ios-labs-s14:​9_5.png }} 
-{{ ios-labs-s14:​9_6.png }} 
-{{ ios-labs-s14:​9_7.png }} 
-{{ ios-labs-s14:​9_8.png }} 
-{{ ios-labs-s14:​9_9.png }} 
-{{ ios-labs-s14:​9_10.png }} 
- 
ios-labs-s14/scratch.txt ยท Last modified: 2014/02/28 14:14 by mbarboi