SlideShare a Scribd company logo
iOS Training
                             Part 2
                            Sam Kirchmeier
                           sam@livefront.com
                             @skirchmeier


Tuesday, March 20, 2012
Getting Started

                    •MobileMarch_Part_2_Start
                    •https://github.com/skirchmeier/
                          mobilemarch-2012-ios




Tuesday, March 20, 2012
•MobileMarch_Part_2_Start
                    •https://github.com/skirchmeier/
                          mobilemarch-2012-ios


Tuesday, March 20, 2012
Topics

                    •Storyboards
                    •Navigation Controllers
                    •Table View Controllers


Tuesday, March 20, 2012
Goals

                    1. Display a list of tomorrow’s sessions
                    2. Display a live Twitter feed
                    3. Bask in the glory of our iOS prowess




Tuesday, March 20, 2012
Storyboards




Tuesday, March 20, 2012
Scenes
                          View Controllers


                           Segues
                            Transitions


Tuesday, March 20, 2012
Tuesday, March 20, 2012
Scene

Tuesday, March 20, 2012
Segue




                          Scene

Tuesday, March 20, 2012
Segues
                 Old Way
                  - (IBAction)showAboutView:(id)sender
                  {
                      // Use presentModalViewController to
                      // display the view controller.
                  }


                 New Way
                  - (void)prepareForSegue:(UIStoryboardSegue *)segue
                                   sender:(id)sender
                  {
                      // Grab a reference to the view controller via
                      // [segue destinationViewController].
                  }


Tuesday, March 20, 2012
Demo


Tuesday, March 20, 2012
Goal #1
                Display a list of sessions



Tuesday, March 20, 2012
Navigation Controller




Tuesday, March 20, 2012
Tuesday, March 20, 2012
Tuesday, March 20, 2012
View Controller 1   View Controller 2




Tuesday, March 20, 2012
Demo


Tuesday, March 20, 2012
Table View Controller




Tuesday, March 20, 2012
Tuesday, March 20, 2012
Tuesday, March 20, 2012
Navigation Controller




Tuesday, March 20, 2012
Navigation Controller

                          View Controller




Tuesday, March 20, 2012
Navigation Controller

                          View Controller

                            Table View




Tuesday, March 20, 2012
Navigation Controller   Navigation Controller

                          View Controller    Table View Controller

                            Table View            Table View
                                                    Built In




Tuesday, March 20, 2012
Navigation Controller

                          View Controller

                            Table View




Tuesday, March 20, 2012
Navigation Controller

                          View Controller

                            Table View

                            Data Source




                             Delegate




Tuesday, March 20, 2012
Navigation Controller

                          View Controller

                            Table View
                                             Data Source Object
                                                  Number of rows
                            Data Source
                                                 Number of sections
                                             Data to display in each row




                             Delegate




Tuesday, March 20, 2012
Navigation Controller

                          View Controller

                            Table View
                                             Data Source Object
                                                  Number of rows
                            Data Source
                                                 Number of sections
                                             Data to display in each row




                                              Delegate Object
                                                Handle touch events
                             Delegate
                                              Header and footer views
                                                 Rearrange rows




Tuesday, March 20, 2012
Navigation Controller

                          View Controller
                                             UITableViewDataSource
                            Table View
                                             Data Source Object
                                                   Number of rows
                            Data Source
                                                  Number of sections
                                              Data to display in each row



                                              UITableViewDelegate

                                               Delegate Object
                                                 Handle touch events
                             Delegate
                                               Header and footer views
                                                  Rearrange rows




Tuesday, March 20, 2012
Navigation Controller

                          Table View Controller

                               Table View
                                 Built In




Tuesday, March 20, 2012
Navigation Controller

                          Table View Controller

                               Table View
                                 Built In

                               Data Source




                                Delegate




Tuesday, March 20, 2012
UITableViewDataSource
         - (NSInteger)tableView:(UITableView *)tableView
           numberOfRowsInSection:(NSInteger)section
         {
              // Return the number of rows here.
         }



         - (UITableViewCell *)tableView:(UITableView *)tableView
                  cellForRowAtIndexPath:(NSIndexPath *)indexPath
         {
             static NSString *CellIdentifier = @"Cell";
             UITableViewCell *cell =
                 [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

                  // Configure the cell here.

                  return cell;
         }



Tuesday, March 20, 2012
UITableViewDelegate
                          – tableView:didSelectRowAtIndexPath:
                          – tableView:heightForRowAtIndexPath:
                          – tableView:viewForHeaderInSection:
                          – tableView:viewForFooterInSection:
                          (and lots more)




Tuesday, March 20, 2012
UITableViewCell


Tuesday, March 20, 2012
Basic




Tuesday, March 20, 2012
Right Detail




Tuesday, March 20, 2012
Left Detail




Tuesday, March 20, 2012
Subtitle




Tuesday, March 20, 2012
Demo


Tuesday, March 20, 2012
Goal #2
                Display a Twitter feed


Tuesday, March 20, 2012
Twitter Framework


Tuesday, March 20, 2012
TWRequest
          TWRequest *request = [[TWRequest alloc]
                                   initWithURL:URL
                                    parameters:parameters
                                 requestMethod:TWRequestMethodGET];

          [request performRequestWithHandler:^(
              NSData *responseData,
              NSHTTPURLResponse *urlResponse,
              NSError *error)
          {
              // Invoked after the response is complete.
              // Parse response and display tweets.
          }];




Tuesday, March 20, 2012
Request Handler Block

                          ^(NSData *responseData,
                            NSHTTPURLResponse *urlResponse,
                            NSError *error)
                          {
                              // Invoked after the response is complete.
                              // Parse response and display tweets.
                          }




              [request performRequestWithHandler: Request Handler Block ];




Tuesday, March 20, 2012
Threads
              [request performRequestWithHandler: Request Handler Block ];




                                    This handler is
                                   not guaranteed
                                   to be called on
                                    any particular
                                        thread.

                                                         Apple
Tuesday, March 20, 2012
Danger
           Request Handler Block
           ^(NSData *responseData,
             NSHTTPURLResponse *urlResponse,
             NSError *error)
           {
               // Parse the Twitter response.
               ...

                    // Assign an array of tweets to our tweets property.
                    ...

                    // Reload the table view.
                    // This might not work!
                   [self.tableView reloadData];
           }



Tuesday, March 20, 2012
OK
           Request Handler Block
           ^(NSData *responseData,
             NSHTTPURLResponse *urlResponse,
             NSError *error)
           {
               // Parse the Twitter response.
               ...

                    // Assign an array of tweets to our tweets property.
                    ...

                    // Reload the table view. This will work!
                   [self.tableView performSelectorOnMainThread:@selector(reloadData)
                                                    withObject:nil
                                                 waitUntilDone:NO];
           }



Tuesday, March 20, 2012
JSON
                          Twitter Request
                          GET http://search.twitter.com/search.json


                          Twitter Response
                      {
                             "completed_in": 0.108,
                             "page": 1,
                             "results_per_page": 100,
                             "query": "%23mobilemarch+OR+%40mobilemarchtc",
                             ...
                             "results": [
                                 {
                                     "created_at": "Thu, 15 Mar 2012 16:41:16 +0000",
                                     "from_user": "teruterubouzu",
                                     "text": "@mobilemarchtc How late ...",
                                     ...
                                 },
                                 {
                                     "created_at": "Thu, 15 Mar 2012 14:20:49 +0000",
                                     "from_user": "billyspringer",
                                     "text": "RT @smbmsp: RT @philson: ...",
                                     ...


Tuesday, March 20, 2012
Twitter Response
                                                             NSData




                      [NSJSONSerialization
                          JSONObjectWithData: Twitter Response NSData
                                     options:0
                                       error:&error];




                                      Twitter Response
                                         NSDictionary




Tuesday, March 20, 2012
Demo


Tuesday, March 20, 2012
Next Steps

                    •Start your own app!
                    •Apple’s Getting Started Guide
                    •Apple’s Sample Code
                    •WWDC Videos


Tuesday, March 20, 2012
#prowess
                      Sam Kirchmeier, Livefront
                             @skirchmeier

                 Bob McCune, TapHarmonic
                             @bobmccune


Tuesday, March 20, 2012

More Related Content

PDF
Beatles&webdesign
PDF
아이폰강의(4) pdf
PDF
iOS UI Table Views
PDF
Session 14 - Working with table view and search bar
PPTX
iOS Development (Part 2)
PPTX
iOS Guidelines and Naming Conventions Part 1
PPTX
Objective c design pattens-architetcure
PDF
IOS APPs Revision
Beatles&webdesign
아이폰강의(4) pdf
iOS UI Table Views
Session 14 - Working with table view and search bar
iOS Development (Part 2)
iOS Guidelines and Naming Conventions Part 1
Objective c design pattens-architetcure
IOS APPs Revision

Similar to Beginning i os part 2 sam kirchmeier (20)

PDF
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
PDF
iOS Development Seminar Keynote
DOCX
Beginning iOS 7 Development Exploring the iOS SDKby Jack .docx
DOCX
Beginning iOS 7 Development Exploring the iOS SDKby Jack .docx
PDF
Storyboards Slides
PPTX
Android and IOS UI Development (Android 5.0 and iOS 9.0)
PDF
Dev101
PDF
07 Navigation Tab Bar Controllers
PDF
iOS: Table Views
PDF
06 View Controllers
PPSX
IPHONE ONLINE TRAINING
PPSX
IPHONE ONLINE TRAINING
PPT
Mockapp library 100
PPT
Mockapp_Library_110.ppt
PDF
Cross platform mobile development
PDF
Slideshare presentation
PPTX
Mobilize: Make Good Things Come in Small Packages
PPTX
iOS Coding Best Practices
KEY
Cocoa Design Patterns
PDF
Ios 7 Programming Cookbook 2nd Edition Vandad Nahavandipoor
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Development Seminar Keynote
Beginning iOS 7 Development Exploring the iOS SDKby Jack .docx
Beginning iOS 7 Development Exploring the iOS SDKby Jack .docx
Storyboards Slides
Android and IOS UI Development (Android 5.0 and iOS 9.0)
Dev101
07 Navigation Tab Bar Controllers
iOS: Table Views
06 View Controllers
IPHONE ONLINE TRAINING
IPHONE ONLINE TRAINING
Mockapp library 100
Mockapp_Library_110.ppt
Cross platform mobile development
Slideshare presentation
Mobilize: Make Good Things Come in Small Packages
iOS Coding Best Practices
Cocoa Design Patterns
Ios 7 Programming Cookbook 2nd Edition Vandad Nahavandipoor
Ad

More from Mobile March (20)

PDF
Cross-Platform Mobile Development with PhoneGap-Vince Bullinger
PDF
You Can’t Ignore the Tablet-Designing & Developing Universal Apps for Phones ...
PDF
Building Wearables-Kristina Durivage
PDF
The Blossoming Internet of Things Zach Supalla-Spark
PDF
LiveCode Cross-Platform Development-Joel Gerdeen
PDF
The Mobile Evolution‚ Systems vs. Apps - Matthew David
PPTX
Unity-Beyond Games! - Josh Ruis
PPT
IP for Mobile Startups -Ernest Grumbles
PDF
Using Chipmunk Physics to create a iOS Game - Scott Lembcke
PDF
Using Mobile to Achieve Truly Integrated Marketing - Curt Prins
PPTX
Introduction to Core Data - Jason Shapiro
PDF
Developing Custom iOs Applications for Enterprise
PPT
Product Management for Your App
PDF
Robotium Tutorial
PDF
Dueling Banjos: Inter-app Communication
PPT
Guy Thier Keynote Presentation
PPTX
Mobile March Olson presentation 2012
PDF
Bannin mobile march_2012_public
PDF
Beginningi os part1-bobmccune
PDF
Mobile march2012 android101-pt2
Cross-Platform Mobile Development with PhoneGap-Vince Bullinger
You Can’t Ignore the Tablet-Designing & Developing Universal Apps for Phones ...
Building Wearables-Kristina Durivage
The Blossoming Internet of Things Zach Supalla-Spark
LiveCode Cross-Platform Development-Joel Gerdeen
The Mobile Evolution‚ Systems vs. Apps - Matthew David
Unity-Beyond Games! - Josh Ruis
IP for Mobile Startups -Ernest Grumbles
Using Chipmunk Physics to create a iOS Game - Scott Lembcke
Using Mobile to Achieve Truly Integrated Marketing - Curt Prins
Introduction to Core Data - Jason Shapiro
Developing Custom iOs Applications for Enterprise
Product Management for Your App
Robotium Tutorial
Dueling Banjos: Inter-app Communication
Guy Thier Keynote Presentation
Mobile March Olson presentation 2012
Bannin mobile march_2012_public
Beginningi os part1-bobmccune
Mobile march2012 android101-pt2
Ad

Recently uploaded (20)

PDF
Zenith AI: Advanced Artificial Intelligence
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
August Patch Tuesday
PDF
Approach and Philosophy of On baking technology
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Web App vs Mobile App What Should You Build First.pdf
PPTX
A Presentation on Touch Screen Technology
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Hybrid model detection and classification of lung cancer
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
project resource management chapter-09.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
TLE Review Electricity (Electricity).pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
A Presentation on Artificial Intelligence
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Zenith AI: Advanced Artificial Intelligence
NewMind AI Weekly Chronicles - August'25-Week II
August Patch Tuesday
Approach and Philosophy of On baking technology
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Univ-Connecticut-ChatGPT-Presentaion.pdf
Web App vs Mobile App What Should You Build First.pdf
A Presentation on Touch Screen Technology
Heart disease approach using modified random forest and particle swarm optimi...
Hybrid model detection and classification of lung cancer
A comparative study of natural language inference in Swahili using monolingua...
project resource management chapter-09.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
TLE Review Electricity (Electricity).pptx
A comparative analysis of optical character recognition models for extracting...
Chapter 5: Probability Theory and Statistics
A Presentation on Artificial Intelligence
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation_ Review paper, used for researhc scholars
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf

Beginning i os part 2 sam kirchmeier

  • 1. iOS Training Part 2 Sam Kirchmeier sam@livefront.com @skirchmeier Tuesday, March 20, 2012
  • 2. Getting Started •MobileMarch_Part_2_Start •https://github.com/skirchmeier/ mobilemarch-2012-ios Tuesday, March 20, 2012
  • 3. •MobileMarch_Part_2_Start •https://github.com/skirchmeier/ mobilemarch-2012-ios Tuesday, March 20, 2012
  • 4. Topics •Storyboards •Navigation Controllers •Table View Controllers Tuesday, March 20, 2012
  • 5. Goals 1. Display a list of tomorrow’s sessions 2. Display a live Twitter feed 3. Bask in the glory of our iOS prowess Tuesday, March 20, 2012
  • 7. Scenes View Controllers Segues Transitions Tuesday, March 20, 2012
  • 10. Segue Scene Tuesday, March 20, 2012
  • 11. Segues Old Way - (IBAction)showAboutView:(id)sender { // Use presentModalViewController to // display the view controller. } New Way - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Grab a reference to the view controller via // [segue destinationViewController]. } Tuesday, March 20, 2012
  • 13. Goal #1 Display a list of sessions Tuesday, March 20, 2012
  • 17. View Controller 1 View Controller 2 Tuesday, March 20, 2012
  • 23. Navigation Controller View Controller Tuesday, March 20, 2012
  • 24. Navigation Controller View Controller Table View Tuesday, March 20, 2012
  • 25. Navigation Controller Navigation Controller View Controller Table View Controller Table View Table View Built In Tuesday, March 20, 2012
  • 26. Navigation Controller View Controller Table View Tuesday, March 20, 2012
  • 27. Navigation Controller View Controller Table View Data Source Delegate Tuesday, March 20, 2012
  • 28. Navigation Controller View Controller Table View Data Source Object Number of rows Data Source Number of sections Data to display in each row Delegate Tuesday, March 20, 2012
  • 29. Navigation Controller View Controller Table View Data Source Object Number of rows Data Source Number of sections Data to display in each row Delegate Object Handle touch events Delegate Header and footer views Rearrange rows Tuesday, March 20, 2012
  • 30. Navigation Controller View Controller UITableViewDataSource Table View Data Source Object Number of rows Data Source Number of sections Data to display in each row UITableViewDelegate Delegate Object Handle touch events Delegate Header and footer views Rearrange rows Tuesday, March 20, 2012
  • 31. Navigation Controller Table View Controller Table View Built In Tuesday, March 20, 2012
  • 32. Navigation Controller Table View Controller Table View Built In Data Source Delegate Tuesday, March 20, 2012
  • 33. UITableViewDataSource - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows here. } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; // Configure the cell here. return cell; } Tuesday, March 20, 2012
  • 34. UITableViewDelegate – tableView:didSelectRowAtIndexPath: – tableView:heightForRowAtIndexPath: – tableView:viewForHeaderInSection: – tableView:viewForFooterInSection: (and lots more) Tuesday, March 20, 2012
  • 41. Goal #2 Display a Twitter feed Tuesday, March 20, 2012
  • 43. TWRequest TWRequest *request = [[TWRequest alloc] initWithURL:URL parameters:parameters requestMethod:TWRequestMethodGET]; [request performRequestWithHandler:^( NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { // Invoked after the response is complete. // Parse response and display tweets. }]; Tuesday, March 20, 2012
  • 44. Request Handler Block ^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { // Invoked after the response is complete. // Parse response and display tweets. } [request performRequestWithHandler: Request Handler Block ]; Tuesday, March 20, 2012
  • 45. Threads [request performRequestWithHandler: Request Handler Block ]; This handler is not guaranteed to be called on any particular thread. Apple Tuesday, March 20, 2012
  • 46. Danger Request Handler Block ^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { // Parse the Twitter response. ... // Assign an array of tweets to our tweets property. ... // Reload the table view. // This might not work! [self.tableView reloadData]; } Tuesday, March 20, 2012
  • 47. OK Request Handler Block ^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { // Parse the Twitter response. ... // Assign an array of tweets to our tweets property. ... // Reload the table view. This will work! [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; } Tuesday, March 20, 2012
  • 48. JSON Twitter Request GET http://search.twitter.com/search.json Twitter Response { "completed_in": 0.108, "page": 1, "results_per_page": 100, "query": "%23mobilemarch+OR+%40mobilemarchtc", ... "results": [ { "created_at": "Thu, 15 Mar 2012 16:41:16 +0000", "from_user": "teruterubouzu", "text": "@mobilemarchtc How late ...", ... }, { "created_at": "Thu, 15 Mar 2012 14:20:49 +0000", "from_user": "billyspringer", "text": "RT @smbmsp: RT @philson: ...", ... Tuesday, March 20, 2012
  • 49. Twitter Response NSData [NSJSONSerialization JSONObjectWithData: Twitter Response NSData options:0 error:&error]; Twitter Response NSDictionary Tuesday, March 20, 2012
  • 51. Next Steps •Start your own app! •Apple’s Getting Started Guide •Apple’s Sample Code •WWDC Videos Tuesday, March 20, 2012
  • 52. #prowess Sam Kirchmeier, Livefront @skirchmeier Bob McCune, TapHarmonic @bobmccune Tuesday, March 20, 2012