Beginning i os part 2   sam kirchmeier
Upcoming SlideShare
Loading in...5
×
 

Beginning i os part 2 sam kirchmeier

on

  • 1,168 views

Mobile March 2012

Mobile March 2012

Statistics

Views

Total Views
1,168
Views on SlideShare
868
Embed Views
300

Actions

Likes
1
Downloads
20
Comments
0

1 Embed 300

http://mobilemarchtc.com 300

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Beginning i os part 2   sam kirchmeier Beginning i os part 2 sam kirchmeier Presentation Transcript

  • iOS Training Part 2 Sam Kirchmeier sam@livefront.com @skirchmeierTuesday, March 20, 2012
  • Getting Started •MobileMarch_Part_2_Start •https://github.com/skirchmeier/ mobilemarch-2012-iosTuesday, March 20, 2012
  • •MobileMarch_Part_2_Start •https://github.com/skirchmeier/ mobilemarch-2012-iosTuesday, March 20, 2012
  • Topics •Storyboards •Navigation Controllers •Table View ControllersTuesday, 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 prowessTuesday, March 20, 2012
  • StoryboardsTuesday, March 20, 2012
  • Scenes View Controllers Segues TransitionsTuesday, March 20, 2012
  • Tuesday, March 20, 2012
  • SceneTuesday, March 20, 2012
  • Segue SceneTuesday, 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
  • DemoTuesday, March 20, 2012
  • Goal #1 Display a list of sessionsTuesday, March 20, 2012
  • Navigation ControllerTuesday, March 20, 2012
  • Tuesday, March 20, 2012
  • Tuesday, March 20, 2012
  • View Controller 1 View Controller 2Tuesday, March 20, 2012
  • DemoTuesday, March 20, 2012
  • Table View ControllerTuesday, March 20, 2012
  • Tuesday, March 20, 2012
  • Tuesday, March 20, 2012
  • Navigation ControllerTuesday, March 20, 2012
  • Navigation Controller View ControllerTuesday, March 20, 2012
  • Navigation Controller View Controller Table ViewTuesday, March 20, 2012
  • Navigation Controller Navigation Controller View Controller Table View Controller Table View Table View Built InTuesday, March 20, 2012
  • Navigation Controller View Controller Table ViewTuesday, March 20, 2012
  • Navigation Controller View Controller Table View Data Source DelegateTuesday, 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 DelegateTuesday, 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 rowsTuesday, 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 rowsTuesday, March 20, 2012
  • Navigation Controller Table View Controller Table View Built InTuesday, March 20, 2012
  • Navigation Controller Table View Controller Table View Built In Data Source DelegateTuesday, 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
  • UITableViewCellTuesday, March 20, 2012
  • BasicTuesday, March 20, 2012
  • Right DetailTuesday, March 20, 2012
  • Left DetailTuesday, March 20, 2012
  • SubtitleTuesday, March 20, 2012
  • DemoTuesday, March 20, 2012
  • Goal #2 Display a Twitter feedTuesday, March 20, 2012
  • Twitter FrameworkTuesday, 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. AppleTuesday, 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 NSDictionaryTuesday, March 20, 2012
  • DemoTuesday, March 20, 2012
  • Next Steps •Start your own app! •Apple’s Getting Started Guide •Apple’s Sample Code •WWDC VideosTuesday, March 20, 2012
  • #prowess Sam Kirchmeier, Livefront @skirchmeier Bob McCune, TapHarmonic @bobmccuneTuesday, March 20, 2012