User Tools

Site Tools


ios-labs-s14:class-04

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
ios-labs-s14:class-04 [2014/02/17 13:20]
mbarboi [Create Download Method]
ios-labs-s14:class-04 [2014/02/17 13:35] (current)
mbarboi
Line 49: Line 49:
 In the spirit of UX-centric design, we want the user to immediately be presented with his or her grants upon opening the app. RootViewController will display settings and transition buttons on a bar on top of the screen and all grants are listed in the table. In the spirit of UX-centric design, we want the user to immediately be presented with his or her grants upon opening the app. RootViewController will display settings and transition buttons on a bar on top of the screen and all grants are listed in the table.
  
-Everything in this section will be similar to the content covered in the Crash Course with one exceptions. ​You can subclass any view or controller, remember. Just like you can subclass UIViewControllers and customize their views to be unique from other controllers,​ in order to get custom table cells we'll have to roll our own UITableViewCell subclass. This is an important part of using tables, since you will generally want to customize the appearance of your cells.+Everything in this section will be similar to the content covered in the Crash Course with one exceptions. ​Remember you can subclass any view or controller ​to realize custom behavior. Just like you can subclass UIViewControllers and customize their views to be unique from other controllers,​ in order to get custom table cells we'll have to roll our own UITableViewCell subclass. This is an important part of using tables, since you will generally want to customize the appearance of your cells.
  
 ====Add UITableView==== ====Add UITableView====
Line 60: Line 60:
 The table with the new cell added (next step) The table with the new cell added (next step)
  
-The process for adding a UITableViewCell is the same as adding any other viewsimply drag, drop, and customize. +The process for adding a UITableViewCell is the same as adding any other viewsimply drag, drop, and customize. ​To "​Layout"​ an object in iOS development means to add and edit views within the object to set up its overall interface.
  
 ====Layout Custom UITableViewCell==== ====Layout Custom UITableViewCell====
Line 70: Line 69:
  
 Just like sub-classing a controller, you must create a new class, with .h and .m files, that will be instantiated to handle the functionality of your new cell by connecting outlets. Just like sub-classing a controller, you must create a new class, with .h and .m files, that will be instantiated to handle the functionality of your new cell by connecting outlets.
- 
-Note that selecting the cell and opening the assistant editor will not pull up the correct source code file. Assistant editor tries to open whichever file complements the current selection on the main pane, but since the GrantCell is contained within the RootViewController,​ the Assistant picks the controller. You'll have to manually select the appropriate header file by clicking //​Automatic//​ on top of the Assistant Editor, changing it to //Manual//, and drilling through your project files for the right one. 
- 
-When establishing the IBOutlets, do not create braces in the header file! Place them between //​@interface//​ and //@end// without braces. 
  
 ====Subclass UITableViewCell==== ====Subclass UITableViewCell====
Line 84: Line 79:
 {{ ios-labs-s14:​4_6.png }} {{ ios-labs-s14:​4_6.png }}
  
-If you're here in this class now, you've elected to work on an iOS project this semester and may have some interest working on future development. Its then safe to assume you'll have to use a table at some point again, ergo you'll have to complete this next step without hand-holding. Remember: Don't Repeat Yourself. These methods should be copy-pasted from old projects or the internet every time, not written from scratch. ​+Note that selecting the cell and opening the assistant editor will not pull up the correct source code file. Assistant editor tries to open whichever file complements the current selection on the main pane, but since the GrantCell is contained within the RootViewController,​ the Assistant picks the controller. You'll have to manually select the appropriate header file by clicking //​Automatic//​ on top of the Assistant Editor, changing it to //Manual//, and drilling through your project files for the right one. 
 + 
 +When establishing the IBOutlets, do not create braces in the header file! Place them between //​@interface//​ and //@end// without braces. 
 + 
 +If you're here in this class now, you've elected to work on an iOS project this semester and may have some interest working on future development. Its then safe to assume you'll have to use a table at some point again, ergo you'll have to complete this next step without hand-holding. Remember: Don't Repeat Yourself. These methods should be copy-pasted from old projects or the internet every time, not written from scratch.
  
 ====Implement Delegate Methods==== ====Implement Delegate Methods====
Line 109: Line 108:
   -ping- returns success to indicate connectivity to the server   -ping- returns success to indicate connectivity to the server
  
-The most important bit here is understanding how to pass arguments inline with the URL. A '?'​ after a URL signifies the start of the list of arguments as key/value pairs. ​Google ​"hello," ​examine ​the url that is formed in the top bar+The most important bit here is understanding how to pass arguments inline with the URL. A '?'​ after a URL signifies the start of the list of arguments as key/value pairs. ​Open your browser and google ​"hello." ​Examine ​the url that is formed in the top bar
  
   ...?​q=hello&​rlz=1C1CHMO_enUS567US567&​oq=hello&​aqs=chrome..69i57j69i60l2j69i59l2j69i60.554j0j8...   ...?​q=hello&​rlz=1C1CHMO_enUS567US567&​oq=hello&​aqs=chrome..69i57j69i60l2j69i59l2j69i60.554j0j8...
Line 131: Line 130:
  
 ====Preparing RootViewController for API Connectivity==== ====Preparing RootViewController for API Connectivity====
-  -Add an NSMutableArray as a private instance variable, name it "​grants"​+  -Add an NSMutableArray as a property, name it "​grants"​
   -Initialize it   -Initialize it
  
Line 139: Line 138:
   -Create a new method called "​download"​ that takes no parameters and returns nothing.   -Create a new method called "​download"​ that takes no parameters and returns nothing.
   -Copy the following code into it   -Copy the following code into it
 +  -
 <​code>​ <​code>​
     NSString *urlString = [NSString stringWithFormat:​@"​http://​pages.cs.wisc.edu/​~mihnea/​ggt/​sheets/​ggt_handler.php?​type=ping"​];​     NSString *urlString = [NSString stringWithFormat:​@"​http://​pages.cs.wisc.edu/​~mihnea/​ggt/​sheets/​ggt_handler.php?​type=ping"​];​
ios-labs-s14/class-04.txt · Last modified: 2014/02/17 13:35 by mbarboi