SlideShare une entreprise Scribd logo
1  sur  91
Télécharger pour lire hors ligne
iOS App 101
               And how fun is it ?
                 by tomjpsun




12年7月5日星期四
About me

        • MFC Certificate
        • WDM driver (USB)



12年7月5日星期四
About me

        • MFC Certificate   • Linux driver
        • WDM driver (USB) • iOS App



12年7月5日星期四
About me

        • MFC Certificate   • Linux driver
        • WDM driver (USB) • iOS App



12年7月5日星期四
About me

        • MFC Certificate   • Linux driver
        • WDM driver (USB) • iOS App



12年7月5日星期四
About me

        • MFC Certificate   • Linux driver
        • WDM driver (USB) • iOS App

       Not interest any more


12年7月5日星期四
Agenda
             • Development Environment
             • Objective-C
             • Cocoa
             • Design patterns
             • UX
             • References
12年7月5日星期四
Agenda
             • Development Environment
             • Objective-C
             • Cocoa
             • Design patterns
             • UX
             • References
12年7月5日星期四
Tested combinations

                                XCode
                    iOS ver                 OS X ver
                                 ver


                      5.1         4.3      10.7(Lion)



         • XCode   5.0 below      4.2    10.6.8(Leopard)


                               Strictly depends on


12年7月5日星期四
• https://developer.apple.com/programs/
12年7月5日星期四
iOS Dev Center
  https://developer.apple.com/devcenter/ios/index.action




12年7月5日星期四
Provision profile




              Your Mac   Dev Center
12年7月5日星期四
Demo
             • Create an empty App
             • Browse XCode features
              • organizer
              • project configurations
              • simulator
              • download
              • debug
12年7月5日星期四
Agenda
             • Development Environment
             • Objective-C
             • Cocoa
             • Design patterns
             • UX
             • References
12年7月5日星期四
Object oriented



12年7月5日星期四
Message passing
             [instance method];

             寫 iOS 最先看習慣的就是中括號




12年7月5日星期四
Dynamism
             objective-C runtime library




12年7月5日星期四
.h
             #import <Foundation/Foundation.h>

         @interface Fraction: NSObject
         {
             int numerator;
             int denominator;
         }
         -(void) print;
         -(void) setNumerator: (int) n;
         -(void) setDenominator: (int) d;
         @end




12年7月5日星期四
.m
               #import "Fraction.h"

             @implementation Fraction
             -(void) print
             {
                 NSLog(@"%i/%i", numerator, denominator);
             }
             -(void) setNumerator: (int) n
             {
                 numerator = n;
             }
             -(void) setDenominator: (int) d
             {
                 denominator = d;
             }
             @end




12年7月5日星期四
Multiple arguments
             -(void) setTo: (int) n over: (int) d
         {
              numerator = n;
              denominator = d;
         }


         int main (int argc, char *argv[])
         {
             Fraction *aFraction = [[Fraction alloc] init];
             [aFraction setTo: 1 over: 3];
             [aFraction print];   // -> 1/3
             return 0;
         }




12年7月5日星期四
Class method
         @interface Fraction: NSObject
         {
             int numerator;
             int denominator;
         }

         @interface FractionFactory: NSObject

         +(Fraction*) newFractionWithNumerator: (int)numerator
                      andDenominator: (int)denominator;


         int main (int argc, char *argv[])
         {
             Fraction* f = [FractionFactory
                             newFractionWithNumerator: 1
                             andDenominator: 2];
         }



12年7月5日星期四
Synthesized accessor
             #import <Foundation/Foundation.h>

       @interface Fraction: NSObject
       {
           int numerator;
       }
       -(void) setNumerator: (int) n;      // setter
       -(int) numerator;                   // getter
       @end

                 compiler generates getter/setter
   @interface Fraction: NSObject       @implementation Fraction
   @property numerator;                @synthesis numerator;
   @end                                @end




12年7月5日星期四
Dot accessing property
                 [ instance setPoperty: 2];

                  is equal to

                 instance.property = 2;




12年7月5日星期四
self
             • self like this in C++
                  - (id)init
                  {
                      self = [super init];
                      if (self) {
                          // Custom initialization
                      }
                      return self;
                  }




12年7月5日星期四
id


             • something like void*
             • useful at runtime


12年7月5日星期四
selector
             • name of method , function literal
              • compile time
                 SEL aSelector = @selector(methodName);


              • run time
                 SEL aSelector =   NSSelectorFromString(@"print");

                 NSString* selectorStr =

                       NSStringFromSelector(aSelector);
                 NSLog(@"%@", selectorStr);




12年7月5日星期四
selector
             [friend performSelector:@selector(gossipAbout:)

                 withObject:aNeighbor];



             is equal to

             [friend gossipAbout:aNeighbor];




12年7月5日星期四
Runtime
         library
     彈性:原本在 compile
    time, link time 要做的動
    作,延到 run time 再做


12年7月5日星期四
object A
                -(void)fly


             完全沒有任何繼承關係

                object B
                -(void)fly


             SEL userSelector = NSSelectorFromString(@”fly”);
             [ any performSelector: @selector(userSelector) ];


             any 指向 object A, 就呼叫 A 的 fly
             any 指向 object B, 就呼叫 B 的 fly

12年7月5日星期四
Category
      • extending class (even if you don’t have the
             source)
   #import "High.h"

   @interface High (calculate)
   - (NSInteger) plus:(NSInteger)operand1 and:(NSInteger)operand2;
   @end


  @implementation High (calculate)
  - (NSInteger) plus:(NSInteger)operand1 and:(NSInteger)operand2
  {
      return operand1 + operand2;
  }
  @end


12年7月5日星期四
Class extension
             • category without name
             • used as private method declaration in Obj-
               C




12年7月5日星期四
Category may cause
                     chaos

             • category wins over the override function
             • define same function in different
               categories. Lead to undefined condition.




12年7月5日星期四
@protocol

             • class with only methods.
             • classes 之間說好要提供哪些 functions.
         @protocol MyXMLSupport

         - initFromXMLRepresentation:(NSXMLElement *)XMLElement;

         - (NSXMLElement *)XMLRepresentation;

         @end



12年7月5日星期四
memory management

             • MRC - manual reference counting
             • ARC - automatic reference counting
             • garbage collection - in OS X, not in iOS


12年7月5日星期四
MRC
             • Apple’s rule - owner release (owner: copy,
               alloc, retain)
             • burden on developers
             // retain release pair
             id value = [dict retain];
             [value release];

             // autorelease
             array = [[NSMutableArray new] autorelease];




12年7月5日星期四
ARC


             • supported on LLVM 3.0
             • generate release code for you.


12年7月5日星期四
Blocks
         this section is borrowed from WWDC 2011, sec. “block
                            and central dispatch”




                 * ^
12年7月5日星期四
Functions                   Blocks
       // body of code            // body of code
       {                          {

             return   a - b;          return   a - b;

       }                          }

       // pointer to a function   // pointer to a block
       *                          ^




12年7月5日星期四
Functions                   Blocks
       // body of code            // body of code
       {                          {

             return   a - b;          return   a - b;

       }                          }

       // pointer to a function   // pointer to a block
       int (*cmpr)(int, int);     int (^cmpr)(int, int);




12年7月5日星期四
Functions                   Blocks
       // body of code            // body of code
       {                          {

             return   a - b;          return   a - b;

       }                          }

       // pointer to a function   // pointer to a block
       int (*cmpr)(int, int);     int (^cmpr)(int, int);

       typedef int (*func_t)      typedef int (^block_t)
       (int, int);                (int, int);




12年7月5日星期四
Functions                   Blocks
       // body of code            // body of code
       {                          {

             return   a - b;          return   a - b;

       }                          }

       // pointer to a function   // pointer to a block
       int (*cmpr)(int, int);     int (^cmpr)(int, int);

       typedef int (*func_t)      typedef int (^block_t)
       (int, int);                (int, int);

       func_t cmpr = arg;         block_t cmpr = arg;




12年7月5日星期四
Functions                   Blocks
       // body of code            // body of code
       {                          {

             return   a - b;          return    a - b;

       }                          }

       // pointer to a function   // pointer to a block
       int (*cmpr)(int, int);     int (^cmpr)(int, int);

       typedef int (*func_t)      typedef int (^block_t)
       (int, int);                (int, int);

       func_t cmpr = arg;         block_t cmpr = arg;

       cmpr(x, y);                cmpr(x, y);




12年7月5日星期四
Functions                   Blocks
       // body of code            // body of code
       {                          {

             return   a - b;          return   a - b;

       }                          }

       // pointer to a function   // pointer to a block
       *                          ^




12年7月5日星期四
Functions                   Blocks
       // body of code            // body of code
       int my_cmp(int a, int b)   ^(int a, int b)
       {                          {

             return   a - b;          return   a - b;

       }                          }




12年7月5日星期四
Functions                   Blocks
       // body of code            // body of code

       int my_cmp(int a, int b)   ^(int a, int b)
       {                          {

             return   a - b;          return   a - b;

       }                          }

       // usage                   // usage

       sort(array, 10, my_cmp);   sort(array, 10, ^(int a,
                                  int b)
                                  {
                                         return a - b;
                                  });




12年7月5日星期四
closure          Blocks
                       // body of code

                       ^(int a, int b)
                       {

                           return   a - b;

                       }




12年7月5日星期四
closure         Blocks
                       // body of code
                       __block int cnt = 0;
                       ^(int a, int b)
                       {
                           cnt++ ;
                           return a - b;

                       }


                       log(“Count: %d”, cnt);




12年7月5日星期四
Agenda
             • Development Environment
             • Objective-C
             • Cocoa
             • Design patterns
             • UX
             • References
12年7月5日星期四
Cocoa fit in iOS




             不管任何種類的 App,⼀一定會用到 UIKit

12年7月5日星期四
UIKit Philosophy
             • MVC




12年7月5日星期四
View Controllers




12年7月5日星期四
Anatomy




12年7月5日星期四
View Controllers
               Manage Views




12年7月5日星期四
View Controllers
               Manage Views




12年7月5日星期四
View Controllers
               Manage Views




12年7月5日星期四
View




12年7月5日星期四
Important Documents



             View Controller Programming Guide for iOS
             View Programming Guide



12年7月5日星期四
Agenda
             • Development Environment
             • Objective-C
             • Cocoa
             • Design patterns
             • UX
             • References
12年7月5日星期四
delegate
                   iOS
               UIApplication
                  object




                                   MyApp
              delegate
      implemented via @protocol

12年7月5日星期四
delegate
                   iOS
               UIApplication
                  object




             App 可以開始嗎?
                                   MyApp
              delegate
      implemented via @protocol

12年7月5日星期四
delegate
                   iOS
               UIApplication
                  object




             App 可以開始嗎?
                                   MyApp
              delegate
      implemented via @protocol

12年7月5日星期四
delegate
                   iOS
               UIApplication
                  object
                                  可以


             App 可以開始嗎?
                                   MyApp
              delegate
      implemented via @protocol

12年7月5日星期四
delegate
                   iOS
               UIApplication
                  object




                                   MyApp
              delegate
      implemented via @protocol

12年7月5日星期四
delegate
                   iOS
               UIApplication
                  object




             App 將要結束!
                                   MyApp
              delegate
      implemented via @protocol

12年7月5日星期四
delegate
                   iOS         不用回答,因為只
               UIApplication
                  object
                               是知會你的 App



             App 將要結束!
                                   MyApp
              delegate
      implemented via @protocol

12年7月5日星期四
delegate
                   iOS
               UIApplication
                  object



             @protocol

                                   MyApp
              delegate
      implemented via @protocol

12年7月5日星期四
delegate
                   iOS
               UIApplication
                  object          some delegates
                                    are optional


             @protocol

                                        MyApp
              delegate
      implemented via @protocol

12年7月5日星期四
delegate


             • no need to subclassing everywhere.
             • de-coupling decision, cleaner design.


12年7月5日星期四
delegate demo


             https://github.com/tomjpsun/TestObjc.git


12年7月5日星期四
Data-Source
             • nearly the same as delegate, 但是提供 data
               而非 UI 決策.

                     有幾個 sections ?

                             4
                                        TableView
                        sec 1 cell 1    Controller
                      “Clear History”




12年7月5日星期四
Data-Source
             • nearly the same as delegate, 但是提供 data
               而非 UI 決策.

                     有幾個 sections ?

                             4
                                        TableView    Data Source
                        sec 1 cell 1    Controller
                      “Clear History”




12年7月5日星期四
Target-Action
                                                                Button
                              send message when the
                                   event occurs
                                                           ViewController
                                                         -(void)myButtonPressed:
             - (void)viewDidLoad
             {
                [super viewDidLoad];
             ! [self.myButton addTarget:self
             action:@selector(myButtonPressed:)
             forControlEvents:UIControlEventTouchUpInside];
             }

             - (void)myButtonPressed:(UIButton*)button
             {
                 ...
             }

12年7月5日星期四
Notification
                                                     observer 1

                               Notification
             anObject                                observer 2
                                Center
                       post
                    notification                      observer 3
                                        broadcast
                                       notification

                        reduce the code coupling


12年7月5日星期四
Singleton
                                                                   request 1
                                    request 1
                                                                   response 1
             Typical class response 1 A             Singleton
                                                                                A
                                                                response 2
                                        request 2
                      response 2
                                    B                               request 2




              • 系統內,只能有⼀一份 instance,以某種標
                 準的 shared 方式共用之.


12年7月5日星期四
Singleton

             • 是好的 design pattern ? 正反面討論很多
             • Cocoa 很多用到 singleton pattern
              Notification
                            UIApplication   NSFileManager
               Center




12年7月5日星期四
Agenda
             • Development Environment
             • Objective-C
             • Cocoa
             • Design patterns
             • UX
             • References
12年7月5日星期四
abstract from the “Tap Worthy” book


             Get it done quick

                      你想要做的




12年7月5日星期四
abstract from the “Tap Worthy” book


             Get it done quick

                      你想要做的




12年7月5日星期四
abstract from the “Tap Worthy” book


             Get it done quick

                      你想要做的




                      使用者實際需要的



12年7月5日星期四
abstract from the “Tap Worthy” book


               依使用習慣分類

             • 微任務化
             • 找在地資訊
             • 排遣無聊


12年7月5日星期四
abstract from the “Tap Worthy” book


               拇指習慣




             左上和右上角,比較不容易按

12年7月5日星期四
abstract from the “Tap Worthy” book


              神奇的 44




             手指可觸碰到的最小的限度
12年7月5日星期四
Agenda
             • Development Environment
             • Objective-C
             • Cocoa
             • Design patterns
             • UX
             • References
12年7月5日星期四
Agenda
             • Development Environment
             • Objective-C
             • Cocoa
             • Design patterns
             • UX
             • References 勸敗時間到了 !
12年7月5日星期四
Objective-C 入門




         http://www.amazon.com/Programming-Objective-C-2-0-2nd-Edition/dp/0321566157




12年7月5日星期四
Cocoa 入門




       http://www.amazon.com/Cocoa-Design-Patterns-Erik-Buck/dp/0321535022/ref=sr_1_1?
          s=books&ie=UTF8&qid=1341483494&sr=1-1&keywords=cocoa+design+patterns



12年7月5日星期四
Online Videos



             • CS193p in iTunes U(niversity)


12年7月5日星期四
User Experience




         http://www.amazon.com/Tapworthy-Designing-Great-iPhone-Apps/dp/1449381650/
          ref=sr_1_1?s=books&ie=UTF8&qid=1341483149&sr=1-1&keywords=tapworthy




12年7月5日星期四
唯⼀一免費的


                XCode documents




12年7月5日星期四
唯⼀一免費的


                 XCode documents




              免費的最硬

12年7月5日星期四
Q &A




12年7月5日星期四

Contenu connexe

Tendances

認識 C++11 新標準及使用 AMP 函式庫作平行運算
認識 C++11 新標準及使用 AMP 函式庫作平行運算認識 C++11 新標準及使用 AMP 函式庫作平行運算
認識 C++11 新標準及使用 AMP 函式庫作平行運算建興 王
 
Mokoversity Course: Apple Swift 101 - Introduction
Mokoversity Course: Apple Swift 101 - IntroductionMokoversity Course: Apple Swift 101 - Introduction
Mokoversity Course: Apple Swift 101 - IntroductionJollen Chen
 
千呼萬喚始出來的 Java SE 7
千呼萬喚始出來的 Java SE 7千呼萬喚始出來的 Java SE 7
千呼萬喚始出來的 Java SE 7Justin Lin
 
Objc under the_hood_2013
Objc under the_hood_2013Objc under the_hood_2013
Objc under the_hood_2013Michael Pan
 
如何用JDK8實作一個小型的關聯式資料庫系統
如何用JDK8實作一個小型的關聯式資料庫系統如何用JDK8實作一個小型的關聯式資料庫系統
如何用JDK8實作一個小型的關聯式資料庫系統なおき きしだ
 
JavaScript object model
JavaScript object modelJavaScript object model
JavaScript object modelKenerLinfeng
 
Programming in Objective-C
Programming in Objective-CProgramming in Objective-C
Programming in Objective-CRyan Chung
 
ES5 introduction
ES5 introductionES5 introduction
ES5 introductionotakustay
 
lambda/closure – JavaScript、Python、Scala 到 Java SE 7
lambda/closure – JavaScript、Python、Scala 到 Java SE 7lambda/closure – JavaScript、Python、Scala 到 Java SE 7
lambda/closure – JavaScript、Python、Scala 到 Java SE 7Justin Lin
 
Ecmascript
EcmascriptEcmascript
Ecmascriptjay li
 
2, object oriented programming
2, object oriented programming2, object oriented programming
2, object oriented programmingted-xu
 
Java Script 引擎技术
Java Script 引擎技术Java Script 引擎技术
Java Script 引擎技术bigqiang zou
 
5, initialization & cleanup
5, initialization & cleanup5, initialization & cleanup
5, initialization & cleanupted-xu
 
深入淺出 Web 容器 - Tomcat 原始碼分析
深入淺出 Web 容器  - Tomcat 原始碼分析深入淺出 Web 容器  - Tomcat 原始碼分析
深入淺出 Web 容器 - Tomcat 原始碼分析Justin Lin
 
從 Singleton 談 constructor
從 Singleton 談 constructor從 Singleton 談 constructor
從 Singleton 談 constructorLuba Tang
 
C++11综述/新特性描述/Overview of C++11 New Features
C++11综述/新特性描述/Overview of C++11 New FeaturesC++11综述/新特性描述/Overview of C++11 New Features
C++11综述/新特性描述/Overview of C++11 New FeaturesPeien Luo
 
The Evolution of Async Programming (GZ TechParty C#)
The Evolution of Async Programming (GZ TechParty C#)The Evolution of Async Programming (GZ TechParty C#)
The Evolution of Async Programming (GZ TechParty C#)jeffz
 

Tendances (17)

認識 C++11 新標準及使用 AMP 函式庫作平行運算
認識 C++11 新標準及使用 AMP 函式庫作平行運算認識 C++11 新標準及使用 AMP 函式庫作平行運算
認識 C++11 新標準及使用 AMP 函式庫作平行運算
 
Mokoversity Course: Apple Swift 101 - Introduction
Mokoversity Course: Apple Swift 101 - IntroductionMokoversity Course: Apple Swift 101 - Introduction
Mokoversity Course: Apple Swift 101 - Introduction
 
千呼萬喚始出來的 Java SE 7
千呼萬喚始出來的 Java SE 7千呼萬喚始出來的 Java SE 7
千呼萬喚始出來的 Java SE 7
 
Objc under the_hood_2013
Objc under the_hood_2013Objc under the_hood_2013
Objc under the_hood_2013
 
如何用JDK8實作一個小型的關聯式資料庫系統
如何用JDK8實作一個小型的關聯式資料庫系統如何用JDK8實作一個小型的關聯式資料庫系統
如何用JDK8實作一個小型的關聯式資料庫系統
 
JavaScript object model
JavaScript object modelJavaScript object model
JavaScript object model
 
Programming in Objective-C
Programming in Objective-CProgramming in Objective-C
Programming in Objective-C
 
ES5 introduction
ES5 introductionES5 introduction
ES5 introduction
 
lambda/closure – JavaScript、Python、Scala 到 Java SE 7
lambda/closure – JavaScript、Python、Scala 到 Java SE 7lambda/closure – JavaScript、Python、Scala 到 Java SE 7
lambda/closure – JavaScript、Python、Scala 到 Java SE 7
 
Ecmascript
EcmascriptEcmascript
Ecmascript
 
2, object oriented programming
2, object oriented programming2, object oriented programming
2, object oriented programming
 
Java Script 引擎技术
Java Script 引擎技术Java Script 引擎技术
Java Script 引擎技术
 
5, initialization & cleanup
5, initialization & cleanup5, initialization & cleanup
5, initialization & cleanup
 
深入淺出 Web 容器 - Tomcat 原始碼分析
深入淺出 Web 容器  - Tomcat 原始碼分析深入淺出 Web 容器  - Tomcat 原始碼分析
深入淺出 Web 容器 - Tomcat 原始碼分析
 
從 Singleton 談 constructor
從 Singleton 談 constructor從 Singleton 談 constructor
從 Singleton 談 constructor
 
C++11综述/新特性描述/Overview of C++11 New Features
C++11综述/新特性描述/Overview of C++11 New FeaturesC++11综述/新特性描述/Overview of C++11 New Features
C++11综述/新特性描述/Overview of C++11 New Features
 
The Evolution of Async Programming (GZ TechParty C#)
The Evolution of Async Programming (GZ TechParty C#)The Evolution of Async Programming (GZ TechParty C#)
The Evolution of Async Programming (GZ TechParty C#)
 

En vedette

Facebook App Dev101 (Tyler Ballance, Slide.com)
Facebook App Dev101 (Tyler Ballance, Slide.com)Facebook App Dev101 (Tyler Ballance, Slide.com)
Facebook App Dev101 (Tyler Ballance, Slide.com)Dave McClure
 
PMO India App Wireframes - BICS India v.1.0
PMO India App Wireframes - BICS India v.1.0PMO India App Wireframes - BICS India v.1.0
PMO India App Wireframes - BICS India v.1.0Srinivas Keerthiprakasam
 
W.3 - IGD 222 INTERFACE DESIGN [ 2559 ]
W.3 - IGD 222 INTERFACE DESIGN [ 2559 ]W.3 - IGD 222 INTERFACE DESIGN [ 2559 ]
W.3 - IGD 222 INTERFACE DESIGN [ 2559 ]THs.ECq Studio's
 
Recruiting Strategy Analysis
Recruiting Strategy AnalysisRecruiting Strategy Analysis
Recruiting Strategy AnalysisLesley Braxton
 
Wireframe and Mockup Templates by Creately
Wireframe and Mockup Templates by CreatelyWireframe and Mockup Templates by Creately
Wireframe and Mockup Templates by CreatelyCreately
 
UX 101: A quick & dirty introduction to user experience strategy & design
UX 101: A quick & dirty introduction to user experience strategy & designUX 101: A quick & dirty introduction to user experience strategy & design
UX 101: A quick & dirty introduction to user experience strategy & designMorgan McKeagney
 
Mobile App Design Proposal
Mobile App Design ProposalMobile App Design Proposal
Mobile App Design ProposalEze Ikedi
 
UX Design + UI Design: Injecting a brand persona!
UX Design + UI Design: Injecting a brand persona!UX Design + UI Design: Injecting a brand persona!
UX Design + UI Design: Injecting a brand persona!Jayan Narayanan
 
Business Plan - Mobile Application Development
Business Plan - Mobile Application DevelopmentBusiness Plan - Mobile Application Development
Business Plan - Mobile Application DevelopmentSarabjeet Singh Dua
 

En vedette (12)

Facebook App Dev101 (Tyler Ballance, Slide.com)
Facebook App Dev101 (Tyler Ballance, Slide.com)Facebook App Dev101 (Tyler Ballance, Slide.com)
Facebook App Dev101 (Tyler Ballance, Slide.com)
 
PMO India App Wireframes - BICS India v.1.0
PMO India App Wireframes - BICS India v.1.0PMO India App Wireframes - BICS India v.1.0
PMO India App Wireframes - BICS India v.1.0
 
BoS 2016 Wireframe App Temp Beantowners
BoS 2016 Wireframe App Temp BeantownersBoS 2016 Wireframe App Temp Beantowners
BoS 2016 Wireframe App Temp Beantowners
 
W.3 - IGD 222 INTERFACE DESIGN [ 2559 ]
W.3 - IGD 222 INTERFACE DESIGN [ 2559 ]W.3 - IGD 222 INTERFACE DESIGN [ 2559 ]
W.3 - IGD 222 INTERFACE DESIGN [ 2559 ]
 
UX & UI Design 101
UX & UI Design 101UX & UI Design 101
UX & UI Design 101
 
Recruiting Strategy Analysis
Recruiting Strategy AnalysisRecruiting Strategy Analysis
Recruiting Strategy Analysis
 
Wireframe and Mockup Templates by Creately
Wireframe and Mockup Templates by CreatelyWireframe and Mockup Templates by Creately
Wireframe and Mockup Templates by Creately
 
Lean Prototyping Guide
Lean Prototyping GuideLean Prototyping Guide
Lean Prototyping Guide
 
UX 101: A quick & dirty introduction to user experience strategy & design
UX 101: A quick & dirty introduction to user experience strategy & designUX 101: A quick & dirty introduction to user experience strategy & design
UX 101: A quick & dirty introduction to user experience strategy & design
 
Mobile App Design Proposal
Mobile App Design ProposalMobile App Design Proposal
Mobile App Design Proposal
 
UX Design + UI Design: Injecting a brand persona!
UX Design + UI Design: Injecting a brand persona!UX Design + UI Design: Injecting a brand persona!
UX Design + UI Design: Injecting a brand persona!
 
Business Plan - Mobile Application Development
Business Plan - Mobile Application DevelopmentBusiness Plan - Mobile Application Development
Business Plan - Mobile Application Development
 

Similaire à iOs app 101

Network and Multitasking
Network and MultitaskingNetwork and Multitasking
Network and Multitaskingyarshure Kong
 
iOS开发常用库推荐之一@techparty
iOS开发常用库推荐之一@techpartyiOS开发常用库推荐之一@techparty
iOS开发常用库推荐之一@techpartyGump Law
 
Node getting start
Node getting startNode getting start
Node getting starttbmallf2e
 
SeaJS - 前端模块化开发探索与网站性能优化实践
SeaJS - 前端模块化开发探索与网站性能优化实践SeaJS - 前端模块化开发探索与网站性能优化实践
SeaJS - 前端模块化开发探索与网站性能优化实践lifesinger
 
那些年,我們一起用過的 Xcode
那些年,我們一起用過的 Xcode那些年,我們一起用過的 Xcode
那些年,我們一起用過的 XcodeMikimoto Chuang
 
了解Php内核
了解Php内核了解Php内核
了解Php内核Er Zhang
 
iOS 入門教學
iOS 入門教學iOS 入門教學
iOS 入門教學Steven Shen
 
Js对象及函数式编程乱步
Js对象及函数式编程乱步Js对象及函数式编程乱步
Js对象及函数式编程乱步Pierre Woo
 
Grails敏捷项目开发
Grails敏捷项目开发Grails敏捷项目开发
Grails敏捷项目开发Michael Yan
 
Concurrency model for mysql data processing@rubyconf.tw 2012
Concurrency model for mysql data processing@rubyconf.tw 2012Concurrency model for mysql data processing@rubyconf.tw 2012
Concurrency model for mysql data processing@rubyconf.tw 2012Mu-Fan Teng
 
jQuery底层架构
jQuery底层架构jQuery底层架构
jQuery底层架构fangdeng
 
KISSY 1.3-released
KISSY 1.3-releasedKISSY 1.3-released
KISSY 1.3-releasedyiming he
 
Tainan.py, Experience about package
Tainan.py, Experience about packageTainan.py, Experience about package
Tainan.py, Experience about packageTim (文昌)
 
Top100summit 芈珺七拼八凑搭建移动自动化测试框架
Top100summit 芈珺七拼八凑搭建移动自动化测试框架Top100summit 芈珺七拼八凑搭建移动自动化测试框架
Top100summit 芈珺七拼八凑搭建移动自动化测试框架drewz lin
 
Android vs e pub
Android vs e pubAndroid vs e pub
Android vs e pub永昇 陳
 
KISSY for starter
KISSY for starterKISSY for starter
KISSY for starteryiming he
 
Sinatra Tutorial@Rubyconf.TW2011
Sinatra Tutorial@Rubyconf.TW2011Sinatra Tutorial@Rubyconf.TW2011
Sinatra Tutorial@Rubyconf.TW2011Mu-Fan Teng
 

Similaire à iOs app 101 (20)

Network and Multitasking
Network and MultitaskingNetwork and Multitasking
Network and Multitasking
 
iOS开发常用库推荐之一@techparty
iOS开发常用库推荐之一@techpartyiOS开发常用库推荐之一@techparty
iOS开发常用库推荐之一@techparty
 
Node getting start
Node getting startNode getting start
Node getting start
 
SeaJS - 前端模块化开发探索与网站性能优化实践
SeaJS - 前端模块化开发探索与网站性能优化实践SeaJS - 前端模块化开发探索与网站性能优化实践
SeaJS - 前端模块化开发探索与网站性能优化实践
 
那些年,我們一起用過的 Xcode
那些年,我們一起用過的 Xcode那些年,我們一起用過的 Xcode
那些年,我們一起用過的 Xcode
 
ios分享
ios分享ios分享
ios分享
 
WSN Project
WSN ProjectWSN Project
WSN Project
 
了解Php内核
了解Php内核了解Php内核
了解Php内核
 
iOS 入門教學
iOS 入門教學iOS 入門教學
iOS 入門教學
 
Js对象及函数式编程乱步
Js对象及函数式编程乱步Js对象及函数式编程乱步
Js对象及函数式编程乱步
 
Grails敏捷项目开发
Grails敏捷项目开发Grails敏捷项目开发
Grails敏捷项目开发
 
Concurrency model for mysql data processing@rubyconf.tw 2012
Concurrency model for mysql data processing@rubyconf.tw 2012Concurrency model for mysql data processing@rubyconf.tw 2012
Concurrency model for mysql data processing@rubyconf.tw 2012
 
jQuery底层架构
jQuery底层架构jQuery底层架构
jQuery底层架构
 
KISSY 1.3-released
KISSY 1.3-releasedKISSY 1.3-released
KISSY 1.3-released
 
Tainan.py, Experience about package
Tainan.py, Experience about packageTainan.py, Experience about package
Tainan.py, Experience about package
 
Top100summit 芈珺七拼八凑搭建移动自动化测试框架
Top100summit 芈珺七拼八凑搭建移动自动化测试框架Top100summit 芈珺七拼八凑搭建移动自动化测试框架
Top100summit 芈珺七拼八凑搭建移动自动化测试框架
 
Android vs e pub
Android vs e pubAndroid vs e pub
Android vs e pub
 
KISSY for starter
KISSY for starterKISSY for starter
KISSY for starter
 
Sourcemap
SourcemapSourcemap
Sourcemap
 
Sinatra Tutorial@Rubyconf.TW2011
Sinatra Tutorial@Rubyconf.TW2011Sinatra Tutorial@Rubyconf.TW2011
Sinatra Tutorial@Rubyconf.TW2011
 

Plus de Tom Sun

Retrolambda+bolts
Retrolambda+boltsRetrolambda+bolts
Retrolambda+boltsTom Sun
 
Cloud radio 閃電秀
Cloud radio 閃電秀Cloud radio 閃電秀
Cloud radio 閃電秀Tom Sun
 
健康報告:德國飲食
健康報告:德國飲食健康報告:德國飲食
健康報告:德國飲食Tom Sun
 
Linux usb2ether
Linux usb2etherLinux usb2ether
Linux usb2etherTom Sun
 
Whos Fault
Whos FaultWhos Fault
Whos FaultTom Sun
 
小巫婆麗特拉
小巫婆麗特拉小巫婆麗特拉
小巫婆麗特拉Tom Sun
 
Serial Pnp
Serial PnpSerial Pnp
Serial PnpTom Sun
 

Plus de Tom Sun (8)

Retrolambda+bolts
Retrolambda+boltsRetrolambda+bolts
Retrolambda+bolts
 
Pioc
PiocPioc
Pioc
 
Cloud radio 閃電秀
Cloud radio 閃電秀Cloud radio 閃電秀
Cloud radio 閃電秀
 
健康報告:德國飲食
健康報告:德國飲食健康報告:德國飲食
健康報告:德國飲食
 
Linux usb2ether
Linux usb2etherLinux usb2ether
Linux usb2ether
 
Whos Fault
Whos FaultWhos Fault
Whos Fault
 
小巫婆麗特拉
小巫婆麗特拉小巫婆麗特拉
小巫婆麗特拉
 
Serial Pnp
Serial PnpSerial Pnp
Serial Pnp
 

iOs app 101

  • 1. iOS App 101 And how fun is it ? by tomjpsun 12年7月5日星期四
  • 2. About me • MFC Certificate • WDM driver (USB) 12年7月5日星期四
  • 3. About me • MFC Certificate • Linux driver • WDM driver (USB) • iOS App 12年7月5日星期四
  • 4. About me • MFC Certificate • Linux driver • WDM driver (USB) • iOS App 12年7月5日星期四
  • 5. About me • MFC Certificate • Linux driver • WDM driver (USB) • iOS App 12年7月5日星期四
  • 6. About me • MFC Certificate • Linux driver • WDM driver (USB) • iOS App Not interest any more 12年7月5日星期四
  • 7. Agenda • Development Environment • Objective-C • Cocoa • Design patterns • UX • References 12年7月5日星期四
  • 8. Agenda • Development Environment • Objective-C • Cocoa • Design patterns • UX • References 12年7月5日星期四
  • 9. Tested combinations XCode iOS ver OS X ver ver 5.1 4.3 10.7(Lion) • XCode 5.0 below 4.2 10.6.8(Leopard) Strictly depends on 12年7月5日星期四
  • 11. iOS Dev Center https://developer.apple.com/devcenter/ios/index.action 12年7月5日星期四
  • 12. Provision profile Your Mac Dev Center 12年7月5日星期四
  • 13. Demo • Create an empty App • Browse XCode features • organizer • project configurations • simulator • download • debug 12年7月5日星期四
  • 14. Agenda • Development Environment • Objective-C • Cocoa • Design patterns • UX • References 12年7月5日星期四
  • 16. Message passing [instance method]; 寫 iOS 最先看習慣的就是中括號 12年7月5日星期四
  • 17. Dynamism objective-C runtime library 12年7月5日星期四
  • 18. .h #import <Foundation/Foundation.h> @interface Fraction: NSObject { int numerator; int denominator; } -(void) print; -(void) setNumerator: (int) n; -(void) setDenominator: (int) d; @end 12年7月5日星期四
  • 19. .m #import "Fraction.h" @implementation Fraction -(void) print { NSLog(@"%i/%i", numerator, denominator); } -(void) setNumerator: (int) n { numerator = n; } -(void) setDenominator: (int) d { denominator = d; } @end 12年7月5日星期四
  • 20. Multiple arguments -(void) setTo: (int) n over: (int) d { numerator = n; denominator = d; } int main (int argc, char *argv[]) { Fraction *aFraction = [[Fraction alloc] init]; [aFraction setTo: 1 over: 3]; [aFraction print]; // -> 1/3 return 0; } 12年7月5日星期四
  • 21. Class method @interface Fraction: NSObject { int numerator; int denominator; } @interface FractionFactory: NSObject +(Fraction*) newFractionWithNumerator: (int)numerator andDenominator: (int)denominator; int main (int argc, char *argv[]) { Fraction* f = [FractionFactory newFractionWithNumerator: 1 andDenominator: 2]; } 12年7月5日星期四
  • 22. Synthesized accessor #import <Foundation/Foundation.h> @interface Fraction: NSObject { int numerator; } -(void) setNumerator: (int) n; // setter -(int) numerator; // getter @end compiler generates getter/setter @interface Fraction: NSObject @implementation Fraction @property numerator; @synthesis numerator; @end @end 12年7月5日星期四
  • 23. Dot accessing property [ instance setPoperty: 2]; is equal to instance.property = 2; 12年7月5日星期四
  • 24. self • self like this in C++ - (id)init { self = [super init]; if (self) { // Custom initialization } return self; } 12年7月5日星期四
  • 25. id • something like void* • useful at runtime 12年7月5日星期四
  • 26. selector • name of method , function literal • compile time SEL aSelector = @selector(methodName); • run time SEL aSelector = NSSelectorFromString(@"print"); NSString* selectorStr = NSStringFromSelector(aSelector); NSLog(@"%@", selectorStr); 12年7月5日星期四
  • 27. selector [friend performSelector:@selector(gossipAbout:) withObject:aNeighbor]; is equal to [friend gossipAbout:aNeighbor]; 12年7月5日星期四
  • 28. Runtime library 彈性:原本在 compile time, link time 要做的動 作,延到 run time 再做 12年7月5日星期四
  • 29. object A -(void)fly 完全沒有任何繼承關係 object B -(void)fly SEL userSelector = NSSelectorFromString(@”fly”); [ any performSelector: @selector(userSelector) ]; any 指向 object A, 就呼叫 A 的 fly any 指向 object B, 就呼叫 B 的 fly 12年7月5日星期四
  • 30. Category • extending class (even if you don’t have the source) #import "High.h" @interface High (calculate) - (NSInteger) plus:(NSInteger)operand1 and:(NSInteger)operand2; @end @implementation High (calculate) - (NSInteger) plus:(NSInteger)operand1 and:(NSInteger)operand2 { return operand1 + operand2; } @end 12年7月5日星期四
  • 31. Class extension • category without name • used as private method declaration in Obj- C 12年7月5日星期四
  • 32. Category may cause chaos • category wins over the override function • define same function in different categories. Lead to undefined condition. 12年7月5日星期四
  • 33. @protocol • class with only methods. • classes 之間說好要提供哪些 functions. @protocol MyXMLSupport - initFromXMLRepresentation:(NSXMLElement *)XMLElement; - (NSXMLElement *)XMLRepresentation; @end 12年7月5日星期四
  • 34. memory management • MRC - manual reference counting • ARC - automatic reference counting • garbage collection - in OS X, not in iOS 12年7月5日星期四
  • 35. MRC • Apple’s rule - owner release (owner: copy, alloc, retain) • burden on developers // retain release pair id value = [dict retain]; [value release]; // autorelease array = [[NSMutableArray new] autorelease]; 12年7月5日星期四
  • 36. ARC • supported on LLVM 3.0 • generate release code for you. 12年7月5日星期四
  • 37. Blocks this section is borrowed from WWDC 2011, sec. “block and central dispatch” * ^ 12年7月5日星期四
  • 38. Functions Blocks // body of code // body of code { { return a - b; return a - b; } } // pointer to a function // pointer to a block * ^ 12年7月5日星期四
  • 39. Functions Blocks // body of code // body of code { { return a - b; return a - b; } } // pointer to a function // pointer to a block int (*cmpr)(int, int); int (^cmpr)(int, int); 12年7月5日星期四
  • 40. Functions Blocks // body of code // body of code { { return a - b; return a - b; } } // pointer to a function // pointer to a block int (*cmpr)(int, int); int (^cmpr)(int, int); typedef int (*func_t) typedef int (^block_t) (int, int); (int, int); 12年7月5日星期四
  • 41. Functions Blocks // body of code // body of code { { return a - b; return a - b; } } // pointer to a function // pointer to a block int (*cmpr)(int, int); int (^cmpr)(int, int); typedef int (*func_t) typedef int (^block_t) (int, int); (int, int); func_t cmpr = arg; block_t cmpr = arg; 12年7月5日星期四
  • 42. Functions Blocks // body of code // body of code { { return a - b; return a - b; } } // pointer to a function // pointer to a block int (*cmpr)(int, int); int (^cmpr)(int, int); typedef int (*func_t) typedef int (^block_t) (int, int); (int, int); func_t cmpr = arg; block_t cmpr = arg; cmpr(x, y); cmpr(x, y); 12年7月5日星期四
  • 43. Functions Blocks // body of code // body of code { { return a - b; return a - b; } } // pointer to a function // pointer to a block * ^ 12年7月5日星期四
  • 44. Functions Blocks // body of code // body of code int my_cmp(int a, int b) ^(int a, int b) { { return a - b; return a - b; } } 12年7月5日星期四
  • 45. Functions Blocks // body of code // body of code int my_cmp(int a, int b) ^(int a, int b) { { return a - b; return a - b; } } // usage // usage sort(array, 10, my_cmp); sort(array, 10, ^(int a, int b) { return a - b; }); 12年7月5日星期四
  • 46. closure Blocks // body of code ^(int a, int b) { return a - b; } 12年7月5日星期四
  • 47. closure Blocks // body of code __block int cnt = 0; ^(int a, int b) { cnt++ ; return a - b; } log(“Count: %d”, cnt); 12年7月5日星期四
  • 48. Agenda • Development Environment • Objective-C • Cocoa • Design patterns • UX • References 12年7月5日星期四
  • 49. Cocoa fit in iOS 不管任何種類的 App,⼀一定會用到 UIKit 12年7月5日星期四
  • 50. UIKit Philosophy • MVC 12年7月5日星期四
  • 53. View Controllers Manage Views 12年7月5日星期四
  • 54. View Controllers Manage Views 12年7月5日星期四
  • 55. View Controllers Manage Views 12年7月5日星期四
  • 57. Important Documents View Controller Programming Guide for iOS View Programming Guide 12年7月5日星期四
  • 58. Agenda • Development Environment • Objective-C • Cocoa • Design patterns • UX • References 12年7月5日星期四
  • 59. delegate iOS UIApplication object MyApp delegate implemented via @protocol 12年7月5日星期四
  • 60. delegate iOS UIApplication object App 可以開始嗎? MyApp delegate implemented via @protocol 12年7月5日星期四
  • 61. delegate iOS UIApplication object App 可以開始嗎? MyApp delegate implemented via @protocol 12年7月5日星期四
  • 62. delegate iOS UIApplication object 可以 App 可以開始嗎? MyApp delegate implemented via @protocol 12年7月5日星期四
  • 63. delegate iOS UIApplication object MyApp delegate implemented via @protocol 12年7月5日星期四
  • 64. delegate iOS UIApplication object App 將要結束! MyApp delegate implemented via @protocol 12年7月5日星期四
  • 65. delegate iOS 不用回答,因為只 UIApplication object 是知會你的 App App 將要結束! MyApp delegate implemented via @protocol 12年7月5日星期四
  • 66. delegate iOS UIApplication object @protocol MyApp delegate implemented via @protocol 12年7月5日星期四
  • 67. delegate iOS UIApplication object some delegates are optional @protocol MyApp delegate implemented via @protocol 12年7月5日星期四
  • 68. delegate • no need to subclassing everywhere. • de-coupling decision, cleaner design. 12年7月5日星期四
  • 69. delegate demo https://github.com/tomjpsun/TestObjc.git 12年7月5日星期四
  • 70. Data-Source • nearly the same as delegate, 但是提供 data 而非 UI 決策. 有幾個 sections ? 4 TableView sec 1 cell 1 Controller “Clear History” 12年7月5日星期四
  • 71. Data-Source • nearly the same as delegate, 但是提供 data 而非 UI 決策. 有幾個 sections ? 4 TableView Data Source sec 1 cell 1 Controller “Clear History” 12年7月5日星期四
  • 72. Target-Action Button send message when the event occurs ViewController -(void)myButtonPressed: - (void)viewDidLoad { [super viewDidLoad]; ! [self.myButton addTarget:self action:@selector(myButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; } - (void)myButtonPressed:(UIButton*)button { ... } 12年7月5日星期四
  • 73. Notification observer 1 Notification anObject observer 2 Center post notification observer 3 broadcast notification reduce the code coupling 12年7月5日星期四
  • 74. Singleton request 1 request 1 response 1 Typical class response 1 A Singleton A response 2 request 2 response 2 B request 2 • 系統內,只能有⼀一份 instance,以某種標 準的 shared 方式共用之. 12年7月5日星期四
  • 75. Singleton • 是好的 design pattern ? 正反面討論很多 • Cocoa 很多用到 singleton pattern Notification UIApplication NSFileManager Center 12年7月5日星期四
  • 76. Agenda • Development Environment • Objective-C • Cocoa • Design patterns • UX • References 12年7月5日星期四
  • 77. abstract from the “Tap Worthy” book Get it done quick 你想要做的 12年7月5日星期四
  • 78. abstract from the “Tap Worthy” book Get it done quick 你想要做的 12年7月5日星期四
  • 79. abstract from the “Tap Worthy” book Get it done quick 你想要做的 使用者實際需要的 12年7月5日星期四
  • 80. abstract from the “Tap Worthy” book 依使用習慣分類 • 微任務化 • 找在地資訊 • 排遣無聊 12年7月5日星期四
  • 81. abstract from the “Tap Worthy” book 拇指習慣 左上和右上角,比較不容易按 12年7月5日星期四
  • 82. abstract from the “Tap Worthy” book 神奇的 44 手指可觸碰到的最小的限度 12年7月5日星期四
  • 83. Agenda • Development Environment • Objective-C • Cocoa • Design patterns • UX • References 12年7月5日星期四
  • 84. Agenda • Development Environment • Objective-C • Cocoa • Design patterns • UX • References 勸敗時間到了 ! 12年7月5日星期四
  • 85. Objective-C 入門 http://www.amazon.com/Programming-Objective-C-2-0-2nd-Edition/dp/0321566157 12年7月5日星期四
  • 86. Cocoa 入門 http://www.amazon.com/Cocoa-Design-Patterns-Erik-Buck/dp/0321535022/ref=sr_1_1? s=books&ie=UTF8&qid=1341483494&sr=1-1&keywords=cocoa+design+patterns 12年7月5日星期四
  • 87. Online Videos • CS193p in iTunes U(niversity) 12年7月5日星期四
  • 88. User Experience http://www.amazon.com/Tapworthy-Designing-Great-iPhone-Apps/dp/1449381650/ ref=sr_1_1?s=books&ie=UTF8&qid=1341483149&sr=1-1&keywords=tapworthy 12年7月5日星期四
  • 89. 唯⼀一免費的 XCode documents 12年7月5日星期四
  • 90. 唯⼀一免費的 XCode documents 免費的最硬 12年7月5日星期四