Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

iOS development introduction

557 Aufrufe

Veröffentlicht am

iOS development introduction

Veröffentlicht in: Software
  • Loggen Sie sich ein, um Kommentare anzuzeigen.

  • Gehören Sie zu den Ersten, denen das gefällt!

iOS development introduction

  1. 1. Introduction To iOS Application Development iOS Application Development
  2. 2. What is iOS ? What are the requirement to develop iOS application ? What is Objective C ? How to develop Simple iOS Application ?
  3. 3. What is iOS ? iOS which was previously called iPhone OS is a mobile operating system developed by Apple . Its first release was in 2007 which included iPhone and iPod Touch. iPad (1st Generation) was released in the April 2010 and iPad mini was released in November 2012 . iOS is derived from OS X, with which it shares the Darwin foundation.
  4. 4. Requirements Must have a mac . Xcode Xcode is Apple’s integrated development environment (IDE). Xcode includes a source editor, a graphical user interface editor, and many other features. iOS SDK .
  5. 5. Objective C The language used in iOS development is objective C. Its additions to C language and mostly based on Smalltalk, one of the first object-oriented programming languages. Objective-C is a simple language. Its syntax is small, unambiguous, and easy to learn . Class Instance. Instance Variable Method
  6. 6. Properties Categories Protocol
  7. 7. Class In objective C the file where the declaration of class is done is called the interface file and the file where the class is defined is called the implementation file. A simple interface file MyClass.h would look like the following. @interface MyClass : NSObject{ // class variable declared here } // class properties declared here // class methods and instance methods declared here @end
  8. 8. The implementation file MyClass.m would be like follows @implementation MyClass // class methods defined here @end
  9. 9. Instance Object creation is done as follows MyClass *objectName = [[MyClass alloc]init] ; Instance Variable Declaration @interface MyClass : NSObject{ // Instance variable declared here } // class properties declared here // class methods and instance methods declared here @end Instance Variables
  10. 10. Methods Instance Method Method is declared in objective C as follows -(returnType) methodName : (typeName) variable1 : (typeName)variable2; To call this method in the same class we use the following statement [self calculateAreaForRectangleWithLength:30 andBreadth:20];
  11. 11. Class method Class methods can be accessed directly without creating objects for the class. They don't have any objects associated with it. An example is shown below. +(void)simpleClassMethod; It can be accessed by using the class name [MyClass simpleClassMethod];
  12. 12. Properties
  13. 13. An object’s properties let other objects inspect or change its state. Accessor methods (getters and setters) are used as an abstraction for interacting with the object’s underlying data. @property (getter=isRunning, readonly) BOOL running; The goal of the @property directive is to make it easy to create and configure properties by automatically generating these accessor methods.
  14. 14. Protocol A protocol is a group of related properties and methods that can be implemented by any class. They are more flexible than a normal class interface, since they let you reuse a single API declaration in completely unrelated classes. Protocol Declaration @protocol StreetLegal <NSObject> - (void)signalStop; - (void)signalLeftTurn; - (void)signalRightTurn; @end
  15. 15. Protocol Adoption @interface Bicycle : NSObject <StreetLegal> @end @implementation // Implement class methods //Implement Protocol methods @end
  16. 16. Categories Categories are a way to split a single class definition into multiple files. Their goal is to ease the burden of maintaining large code bases by modularizing a class. Categories work just like normal class definitions in that they are composed of an interface and an implementation.
  17. 17. NSObject is the “root” object in Objective-C No direct access to instance variables so we write some get/set “instance methods” Instance methods (affect internal state of class) are preceded with a minus sign “Class methods” (higher level functions) are preceded with a plus sign e.g. create new class Points To Remember
  18. 18. alloc is equivalent to C++ new but it also zeros all variables init should be applied to an instance before use These are often combined in shorthand: ComputerScience* ituCompSci = [[ComputerScience alloc] init]; There is no garbage collection on the iPhone, so we should release all of our instance memory.