Objective-C Crash Course for Web Developers

6,244
-1

Published on

These are the slides of my SXSW 2010 Objective-C Crash Course for Web Developers.

The code samples (and the keynote document) can also be downloaded from http://workshop.verbogt.nl/

Published in: Technology
1 Comment
8 Likes
Statistics
Notes
No Downloads
Views
Total Views
6,244
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
234
Comments
1
Likes
8
Embeds 0
No embeds

No notes for slide


  • Chief Developer
    Backend stuff / JavaScript integration














  • Basic description


  • Questions at the end
    Except for things that aren’t clear
  • Questions at the end
    Except for things that aren’t clear
  • Questions at the end
    Except for things that aren’t clear







































































































  • Objective-C Crash Course for Web Developers

    1. 1. Objective-C Crash Course for Web Developers
    2. 2. About me
    3. 3. About me LinkedIn: jverbogt Twitter: silentjohnny Facebook: silentjohnny E-mail: joris@mangrove.nl
    4. 4. History
    5. 5. iPhone SDK
    6. 6. AppStore
    7. 7. Build your own
    8. 8. TXXI
    9. 9. Today’s Topics
    10. 10. Today’s Topics
    11. 11. Today’s Topics Native iPhone Development
    12. 12. Today’s Topics Native iPhone Development Live Demo
    13. 13. Today’s Topics Native iPhone Development Live Demo Questions
    14. 14. iPhone Development
    15. 15. iPhone Development Tools: Xcode / Interface Builder
    16. 16. iPhone Development Tools: Xcode / Interface Builder Language: Objective-C
    17. 17. iPhone Development Tools: Xcode / Interface Builder Language: Objective-C Frameworks: Foundation / UIKit
    18. 18. Xcode
    19. 19. Xcode Editor
    20. 20. Xcode Editor Debugger
    21. 21. Xcode Editor Debugger Build Tools
    22. 22. Xcode Editor Debugger Build Tools Documentation
    23. 23. Interface Builder
    24. 24. Interface Builder Design UI
    25. 25. Interface Builder Design UI Bind to code
    26. 26. Interface Builder Design UI Bind to code Generate code
    27. 27. iPhone Simulator
    28. 28. iPhone Simulator Easy for debugging
    29. 29. iPhone Simulator Easy for debugging No device needed
    30. 30. iPhone Simulator Easy for debugging No device needed Fast round-trip
    31. 31. Not a real iPhone!
    32. 32. Objective-C
    33. 33. Objective-C
    34. 34. Objective-C Superset of C, can be mixed
    35. 35. Objective-C Superset of C, can be mixed Simple syntax
    36. 36. Objective-C Superset of C, can be mixed Simple syntax Dynamic runtime
    37. 37. OOP in Objective-C
    38. 38. OOP in Objective-C
    39. 39. OOP in Objective-C Single inheritance class tree
    40. 40. OOP in Objective-C Single inheritance class tree Protocols for multi-class behavior
    41. 41. OOP in Objective-C Single inheritance class tree Protocols for multi-class behavior Instance variables are hidden
    42. 42. OOP in Objective-C Single inheritance class tree Protocols for multi-class behavior Instance variables are hidden Objects respond to messages for interaction
    43. 43. OOP in Objective-C Single inheritance class tree Protocols for multi-class behavior Instance variables are hidden Objects respond to messages for interaction Variables are bound to classes at runtime
    44. 44. OOP in Objective-C Single inheritance class tree Protocols for multi-class behavior Instance variables are hidden Objects respond to messages for interaction Variables are bound to classes at runtime There is an anonymous object type ‘id’
    45. 45. Syntax
    46. 46. Syntax
    47. 47. Syntax float moneyInTheBank = 0.0;
    48. 48. Syntax float moneyInTheBank = 0.0; var moneyInTheBank = 0.0;
    49. 49. Syntax
    50. 50. Syntax MacBookPro *myNewMac = [MacBookPro new];
    51. 51. Syntax MacBookPro *myNewMac = [MacBookPro new]; var myNewMac = new MacBookPro();
    52. 52. Syntax
    53. 53. Syntax if (moneyInTheBank > [myNewMac price]) { // Go buy one! }
    54. 54. Syntax if (moneyInTheBank > [myNewMac price]) { // Go buy one! } if (moneyInTheBank > myNewMac.getPrice()) { // Go buy one! }
    55. 55. Syntax
    56. 56. Syntax for (i=1; i<count; i++) { }
    57. 57. Messaging
    58. 58. Messaging
    59. 59. Messaging NSString *name = [person name];
    60. 60. Messaging NSString *name = [person name]; var name = person.getName();
    61. 61. Messaging
    62. 62. Messaging [person setName:@”John”];
    63. 63. Messaging [person setName:@”John”]; person.setName(”John”);
    64. 64. Messaging
    65. 65. Messaging NSUInteger length = [[person name] length];
    66. 66. Messaging NSUInteger length = [[person name] length]; var length = person.getName().getLength();
    67. 67. Messaging
    68. 68. Messaging [person setName:name andAge:21];
    69. 69. Messaging [person setName:name andAge:21]; person.set({name:name, age:21});
    70. 70. Creating Instances
    71. 71. Creating Instances
    72. 72. Creating Instances Person *person = [[Person alloc] init];
    73. 73. Creating Instances Person *person = [[Person alloc] init]; Person *person = [Person new];
    74. 74. Creating Instances Person *person = [[Person alloc] init]; Person *person = [Person new]; Person *person = [Person person];
    75. 75. Memory Management
    76. 76. Memory Management
    77. 77. Memory Management If you allocate memory, you need to clean it up!
    78. 78. Memory Management
    79. 79. Memory Management NSObject *keepMe = [[NSObject alloc] init];
    80. 80. Memory Management NSObject *keepMe = [[NSObject alloc] init]; [keepMe retain];
    81. 81. Memory Management NSObject *keepMe = [[NSObject alloc] init]; [keepMe retain]; [keepMe autorelease];
    82. 82. Memory Management NSObject *keepMe = [[NSObject alloc] init]; [keepMe retain]; [keepMe autorelease]; [keepMe release];
    83. 83. Memory Management NSObject *keepMe = [[NSObject alloc] init]; [keepMe retain]; [keepMe autorelease]; [keepMe release]; NSObject *keepMe = [NSObject object];
    84. 84. Categories
    85. 85. Categories
    86. 86. Categories Extending classes without subclassing
    87. 87. Categories Extending classes without subclassing NSString *json = @”{“test”:”OK”}”;
    88. 88. Categories Extending classes without subclassing NSString *json = @”{“test”:”OK”}”; SBJsonParser *parser = [[SBJsonParser] alloc] init]; NSDictionary *data = [parser objectWithString:json];
    89. 89. Categories Extending classes without subclassing NSString *json = @”{“test”:”OK”}”; NSDictionary *data = [json JSONValue];
    90. 90. Categories
    91. 91. Categories String.prototype.getJSONValue = function() { return ... };
    92. 92. Categories String.prototype.getJSONValue = function() { return ... }; var json = “{”test”:”OK”}”; var myObject = json.getJSONValue();
    93. 93. Foundation Classes
    94. 94. NSString
    95. 95. NSString
    96. 96. NSString NSString *myName = @”joris”;
    97. 97. NSString NSString *myName = @”joris”; NSString *welcome = [NSString stringWithFormat:@”Hello %@”, name];
    98. 98. NSString NSString *myName = @”joris”; NSString *welcome = [NSString stringWithFormat:@”Hello %@”, name]; NSString *greeting = @”Hello ”; NSString *welcome = [greeting stringByAppendingString:name];
    99. 99. NSString NSString *myName = @”joris”; NSString *welcome = [NSString stringWithFormat:@”Hello %@”, name]; NSString *greeting = @”Hello ”; NSString *welcome = [greeting stringByAppendingString:name]; if ([myName isEqualToString:otherName]) { // Strings are equal! }
    100. 100. NSArray
    101. 101. NSArray
    102. 102. NSArray NSArray *myArray = [NSArray arrayWithObjects:@”me”, @”you”, nil];
    103. 103. NSArray NSArray *myArray = [NSArray arrayWithObjects:@”me”, @”you”, nil]; NSUInteger count = [myArray count];
    104. 104. NSArray NSArray *myArray = [NSArray arrayWithObjects:@”me”, @”you”, nil]; NSUInteger count = [myArray count]; NSString *secondItem = [myArray objectAtIndex:1];
    105. 105. NSArray NSArray *myArray = [NSArray arrayWithObjects:@”me”, @”you”, nil]; NSUInteger count = [myArray count]; NSString *secondItem = [myArray objectAtIndex:1]; for (NSString *name in myArray) { NSLog(@”Name: %@”, name); }
    106. 106. NSDictionary
    107. 107. NSDictionary
    108. 108. NSDictionary NSDictionary *myDict = [NSDictionary dictionaryWithObjectsAndKeys: @”joris”, @”firstname”, @”verbogt”, @”lastname”, nil];
    109. 109. NSDictionary NSDictionary *myDict = [NSDictionary dictionaryWithObjectsAndKeys: @”joris”, @”firstname”, @”verbogt”, @”lastname”, nil]; NSString *lastname = [myDict objectForKey:@”lastname”];
    110. 110. UIKit
    111. 111. Delegates
    112. 112. Delegates
    113. 113. Delegates Many UIKit classes define delegate protocols
    114. 114. Delegates Many UIKit classes define delegate protocols No subclassing necessary for custom behavior
    115. 115. Delegates Many UIKit classes define delegate protocols No subclassing necessary for custom behavior Loose coupling
    116. 116. Delegates Many UIKit classes define delegate protocols No subclassing necessary for custom behavior Loose coupling Easy refactoring
    117. 117. Connecting UI Elements
    118. 118. Connecting UI Elements
    119. 119. Connecting UI Elements Code defines outlets to UI elements
    120. 120. Connecting UI Elements Code defines outlets to UI elements Code responds to actions from UI
    121. 121. Connecting UI Elements Code defines outlets to UI elements Code responds to actions from UI UI Elements fire actions to a target
    122. 122. Connecting UI Elements Code defines outlets to UI elements Code responds to actions from UI UI Elements fire actions to a target Again: no subclassing
    123. 123. ViewControllers
    124. 124. ViewControllers
    125. 125. ViewControllers Control a UI view (with sub-views)
    126. 126. ViewControllers Control a UI view (with sub-views) Ready to use, out-of-the-box
    127. 127. ViewControllers Control a UI view (with sub-views) Ready to use, out-of-the-box Can be stacked for navigation
    128. 128. ViewControllers Control a UI view (with sub-views) Ready to use, out-of-the-box Can be stacked for navigation Can be initialized from code or IB
    129. 129. ViewControllers
    130. 130. ViewControllers Useful Subclasses:
    131. 131. ViewControllers Useful Subclasses: TableViewController
    132. 132. ViewControllers Useful Subclasses: TableViewController NavigationController
    133. 133. ViewControllers Useful Subclasses: TableViewController NavigationController TabBarController
    134. 134. Let’s do some coding...
    135. 135. Why?
    136. 136. Why?
    137. 137. Why? Fun challenge
    138. 138. Why? Fun challenge Frameworks
    139. 139. Why? Fun challenge Frameworks Best User Experience
    140. 140. Why? Fun challenge Frameworks Best User Experience Inspiration
    141. 141. Thank you
    142. 142. Copyright Artwork by nozzman.com Presentation by Joris Verbogt This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Netherlands License. Download at http://workshop.verbogt.nl/
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×