14
CS50 Seminar Introduction to iOS

CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

CS50 SeminarIntroduction to iOS

Page 2: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

Design.Code.Build.Innovate

Page 3: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

Objective-C

• Just the same as C/C++

• Except it’s object-oriented

• And much more…

Page 4: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

Library vs. Framework!

• C/C++ ! #include <stdio.h> ! !!

• Objective-C !! #import <UIKit/UIKit.h> !!!!

Page 5: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

Print vs. NSLog!

• C/C++ ! printf(“hello, world”); !!!!

• Objective-C !! NSLog(@“hello, world”); !!!!

NSLog(@“%d”, 42);

NSLog(@“%f”, 1.0);

NSLog(@“%@”, apple);{

Page 6: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

Function vs. Method (Declaring)

!

• C/C++ ! bool function(int n, char *array) { !!! }

• Objective-C ! -(NSArray *)methodWithNumber:(NSUInteger)number andArray:(NSArray *)array { !!! }

* http://stackoverflow.com/questions/7626412/difference-between-int-nsinteger-and-nsuinteger

Page 7: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

Function vs. Method (Calling)

!

• C/C++ ! bool b = function(0, {a, b, c, d}); ! !!

• Objective-C !! NSArray *my_array = [object methodWithNumber:0 andArray:@[a, b, c, d]]; !!!!

Page 8: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

Xcode 5Integrated Development Environment (IDE)

Page 9: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

WorkspaceSingle-Window Interface

Page 10: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

If Statement!

• C/C++ ! if (0 != 1 || a == ‘A’) { !!! }

• Objective-C ! if (0 != 1 || [word isEqualToString:@“hello, world”]) { !!! }

* http://stackoverflow.com/questions/7626412/difference-between-int-nsinteger-and-nsuinteger

Page 11: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

For Statement!

• C/C++ ! for (int i = 0, n = strlen(s); i < n; i++) { !!! }

• Objective-C ! for (NSUInteger i = 0, n = array.count; i < n; i++) { !!! }

* http://stackoverflow.com/questions/7626412/difference-between-int-nsinteger-and-nsuinteger

Page 12: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

http://blog.teamtreehouse.com/an-introduction-to-objective-c

Page 13: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

http://mobile.tutsplus.com/tutorials/iphone/learn-ios-game-development-by-example-10-projects-to-get-you-started/

Page 14: CS50 Seminar Introduction to iOScdn.cs50.net/2013/fall/seminars/intro_to_ios/intro_to_ios.pdf · CS50 Seminar_Introduction to iOS.key Created Date: 11/4/2013 3:33:14 AM

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/

Google search “NSArray”