SlideShare a Scribd company logo
Introduction to iOS
Components of Computer System
RAM
(Random Access Memory)
Disk
(Hard Disk Drive)
CPU
(Central Processing Unit)
How a computer reads our code
Objective-C
This is what our source code is written in.
Compiler
Object Code
(otherwise known as Binary)
eg: 0110001010110101
RAM:
The place where applications run. Computers are
restrained by memory and 80% of program crashes
relate to memory.
Disk:
This is where applications that are not running reside
along with user data.
CPU:
The processor that runs and executes programs
iPhone and iPad
iOS Stack
Core OS
Core Services
Media
Coca Touch
High Level
(Objective C)
Low Level
(C)
Tools
Integrated Development Environment (IDE): Xcode
(Code Editor)
Programming Languages: C, C++, Objective-C and Swift
Main
Other Programs
Instruments, Memory Allocation & Leaks
Exercise 1
Hello World
Step 1: Start a new project in Xcode
Step 2: Navigate to the App Delegate.m file
Step 3: Add the following code:
Step 4: Build and Run!
Part 2
Programming Basics
Variables: Variables are a container that holds some kind of
value.
for example: int myVar = 1;
We now have a variable called myVar and its value is equal to 1;
Functions: Functions are the way a system performs some kind
of action. These can either return a value or not.
Example 1:
int myVar = 1;
[self myFunction];
(void)myFunction
{
myVar = 2;
}
Example 2:
int myVar = 1;
myVar = [self myFunction];
(int)myFunction
{
return 2;
}
Parameters: Parameters are variables passed into a function for
it to do some computation with.
Example 1:
int myVar = 1;
int otherNumber = 20;
int total = [self addNumbers: myVar and: otherNumber];
(int)addNumbers:(int)firstNumber and:(int)secondNumber
{
int result = firstNumber + secondNumber;
return variable;
}
total would equal 21.
C Programming in 1 Slide
Integer
Loops
Array
If Then
Switch
Struct
Preprocessor
Processes the source code before it gets compiled.
Preprocessor performs a search &replace to all occurrences of the name with its value.
Loads all the content of a file into the current file. - Watch out for circular dependancies!
Objective-C: Loads all the content of a file into the current file. Automatically handles circular dependanci
Compiler Specific instructions. Often used as a way for you to easily navigate the code file.
Objective-C
Classes
Objective C is object orientated
This means the source code is split up into files called clas
An Objective C Class has Two Files:
A interface file (.h)
(otherwise known as a header)
A Implementation file (.m)
@implementation ViewController
@end
@interface ViewController : UIViewController
@end
A Header is the public file.
It is where we declare methods and
variables for use by other classes
The Implementation file is where
the logic for the declared methods
goes.
Objective-C: Sending Messages
We want to be able to send messages to a class when tryi
The way we do that is like:
[myClass doSomething];
Objective-C: Sending Messages
With Parameters
If we want to call a function with Parameters we call:
[myClass doSomething: @“aString”];
Objective-C: Sending Messages
With Multiple Parameters
If we want to call a function with Parameters we call:
[myClass doSomethingWith This:@“FirstString”
andThis:@“SecondString”];
Objective-C: Instantiating Objects
When we want to use a class we need to create a
instance of that class in memory. We do that by
calling the classes init method, which stands for
instantiate.
MyClass *object = [[MyClass alloc]init];
NOTE: we called two methods on this alloc and init.
‘alloc’ is the function that allocates the memory
required for the object and then init sets it up.
Objective-C: More Classes
When we alloc and init a class the system sets us
up an instance of our class and then returns a
pointer to its location in memory.
You can have multiple instances of a class.
There are some classes called singletons however. This
means that there is only one of them in the application. An
example of this is the App Delegate.
Objective-C: Singleton Classes
This is something you will come across more as
you go forward however the main one you will
encounter is your AppDelegate.
One use of a singleton is if you have a variable that
needs to be accused through the app then you
would declare it there.
Objective-C: Memory Management
Since were are allocating memory all over the
place we need to clear this up so that other parts of
the program can use it. If we don’t its called a
memory leak.
The good news is that these days Apple has
created something called Automatic Reference
Counting (ARC) which does this for us. We will
cover this more later.
Objective-C: Getters / Setters
Getters and Setters are fairly self explanatory. They
are the methods you would call on your class to get
a value or set a value.
Example:
MyClass *object = [[MyClass alloc]init];
[object setRating:9.5];
double theRating = [object rating];
Objective-C: Getters / Setters
Interface (.h)
Objective-C: Getters / Setters
Implementation (.m)
Objective-C: Properties
More Good News!!!
Apple has created something called properties.
When you declare on of these in the implementation file
it will create the getters and setters behind the scene
We’ll look at these in more depth in the next slide but the main thing here is to see how th
Objective-C: Properties
How do we call a property?
We use something called Dot Notation
MyClass *object = [[MyClass alloc]init];
object.rating = 9.5;
Objective-C: Properties / Memory
Ok back to Memory as Promised
As promised here is the rest of the memory stuff to get to grips with. With ARC iOS will k
This makes our life much easier however we need to help it a bit by telling it what needs
An object can have any of the following:
Strong
Weak
Nonatomic
Atomic
Strong: Keeps the object around as long as
the class is alive and pointing to it.
Weak: Keeps the object around as long as
another object is pointing to it strongly.
Objective-C: Properties / Memory II
Atomic/ Nonatomic:
-atomic is the default, which provides support for using this property
in multiple treads (at no extra cost).
Objective-C: Foundation Classes
In Objective-C we have the same data types as in other lang
Common Objective C object types:
NSString
NSArray
NSDictionary
NSDate
NSNumber
NSData
Immutable
NSMutableString
NSMutableArray
NSMutableDictionary
NSDate
NSNumber
NSData
Mutable
Objective-C: Foundation Classes II
Each one of the types in objective C have a class associate
In those classes are properties such as ‘length’ for NSString
As well as Getters and Setters.
Inheritance and Polymorphism
Inheritance is something that you will encounter at all over ob
Its actually more simple that it looks:
(known as a parent class). This means that the class has all t
Inheritance and Polymorphism
Vehicle
Car BattleShip
Vehicle.h
-(void)move
-(void)turnLeft
-(void)turnRight
BattleShip.h
-(void)shoot
Car.h
-(void)Park
Inheritance and Polymorphism
instance of a class can also be treated as an instance of any
Coca-Touch: Model View Controller
In iOS the standard way to design your app is using someth
It breaks down like this:
Model: Data and Business Rules
View: User Interface Elements
Controller: Behaviour and referee between the model and th
Coca-Touch: Model View Controller
Model View
Controller
UI Storyboard
ViewController.h
Concert.h
Model data source
could be:
File System
Database
Web Service
Core Data
Demo
iOS course day 1
• String with format
• App Coda
• Ray Weinerlich

More Related Content

PDF
Lec 4 06_aug [compatibility mode]
PPTX
Core java online training
PPTX
Intro To C++ - Class 2 - An Introduction To C++
PDF
ознакомления с модулем Entity api
DOCX
Java notes
PPT
Unit 2 Java
PPTX
Java RMI
DOCX
Notes of java first unit
Lec 4 06_aug [compatibility mode]
Core java online training
Intro To C++ - Class 2 - An Introduction To C++
ознакомления с модулем Entity api
Java notes
Unit 2 Java
Java RMI
Notes of java first unit

What's hot (20)

PDF
Object Oriented Programming -- Dr Robert Harle
DOC
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
PDF
Understanding the Entity API Module
PPTX
Introduction to Java
PPTX
JAVA PROGRAMMING
PPT
Java Programming for Designers
PDF
Basic Java Programming
PDF
Introduction to java
PPTX
Core java
PPTX
Intro To C++ - Class 05 - Introduction To Classes, Objects, & Strings
PDF
College Project - Java Disassembler - Description
PPTX
C# lecture 1: Introduction to Dot Net Framework
PPT
Java basic
PPT
Fundamentals of JAVA
PPT
Fundamentals of oop lecture 2
DOCX
Core java notes with examples
DOCX
C++ & Design Patterns - primera parte
PDF
Java programming material for beginners by Nithin, VVCE, Mysuru
PPTX
Introduction to JAVA
Object Oriented Programming -- Dr Robert Harle
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
Understanding the Entity API Module
Introduction to Java
JAVA PROGRAMMING
Java Programming for Designers
Basic Java Programming
Introduction to java
Core java
Intro To C++ - Class 05 - Introduction To Classes, Objects, & Strings
College Project - Java Disassembler - Description
C# lecture 1: Introduction to Dot Net Framework
Java basic
Fundamentals of JAVA
Fundamentals of oop lecture 2
Core java notes with examples
C++ & Design Patterns - primera parte
Java programming material for beginners by Nithin, VVCE, Mysuru
Introduction to JAVA
Ad

Viewers also liked (12)

PPTX
iOS Course day 2
PDF
Mobile design matters - iOS and Android
PPT
Top 10 trends every iOS app development company should follow
PPTX
Android Training (Storing & Shared Preferences)
PDF
SWIFT & IntelliMATCH
PDF
Architecting iOS Project
PPTX
iOS Coding Best Practices
PDF
Mobile App Design course (iOS & Android)
PDF
A swift introduction to Swift
PPTX
Apple iOS
PDF
Swift Introduction
PDF
Swift Programming Language
iOS Course day 2
Mobile design matters - iOS and Android
Top 10 trends every iOS app development company should follow
Android Training (Storing & Shared Preferences)
SWIFT & IntelliMATCH
Architecting iOS Project
iOS Coding Best Practices
Mobile App Design course (iOS & Android)
A swift introduction to Swift
Apple iOS
Swift Introduction
Swift Programming Language
Ad

Similar to iOS course day 1 (20)

PPTX
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
PDF
CS8251_QB_answers.pdf
PPTX
Interoduction to c++
DOCX
Cs6301 programming and datastactures
PPTX
iOS development introduction
PPTX
Introduction to Objective - C
PPTX
Intro to C++ - Class 2 - Objects & Classes
PPTX
Intro To C++ - Class 14 - Midterm Review
PDF
Intro to iOS Development • Made by Many
PPT
iOS Application Development
PDF
Object Oriented Programming With C 2140705 Darshan All Unit Darshan Institute...
PPTX
Chapter 1
PPSX
SRAVANByCPP
PPT
OOPM Introduction.ppt
PDF
Object-oriented programming (OOP) with Complete understanding modules
PDF
OOP lesson1 and Variables.pdf
PPT
iPhone development from a Java perspective (Jazoon '09)
PDF
Programming in Java Unit 1 lesson Notes for Java
PPTX
object oriented programming language in c++
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
CS8251_QB_answers.pdf
Interoduction to c++
Cs6301 programming and datastactures
iOS development introduction
Introduction to Objective - C
Intro to C++ - Class 2 - Objects & Classes
Intro To C++ - Class 14 - Midterm Review
Intro to iOS Development • Made by Many
iOS Application Development
Object Oriented Programming With C 2140705 Darshan All Unit Darshan Institute...
Chapter 1
SRAVANByCPP
OOPM Introduction.ppt
Object-oriented programming (OOP) with Complete understanding modules
OOP lesson1 and Variables.pdf
iPhone development from a Java perspective (Jazoon '09)
Programming in Java Unit 1 lesson Notes for Java
object oriented programming language in c++

Recently uploaded (20)

PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
Current and future trends in Computer Vision.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
737-MAX_SRG.pdf student reference guides
PPTX
Construction Project Organization Group 2.pptx
PPT
introduction to datamining and warehousing
DOCX
573137875-Attendance-Management-System-original
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPT
Total quality management ppt for engineering students
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
PPT on Performance Review to get promotions
PPTX
additive manufacturing of ss316l using mig welding
Safety Seminar civil to be ensured for safe working.
Current and future trends in Computer Vision.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
III.4.1.2_The_Space_Environment.p pdffdf
737-MAX_SRG.pdf student reference guides
Construction Project Organization Group 2.pptx
introduction to datamining and warehousing
573137875-Attendance-Management-System-original
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
Total quality management ppt for engineering students
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT on Performance Review to get promotions
additive manufacturing of ss316l using mig welding

iOS course day 1

  • 2. Components of Computer System RAM (Random Access Memory) Disk (Hard Disk Drive) CPU (Central Processing Unit)
  • 3. How a computer reads our code Objective-C This is what our source code is written in. Compiler Object Code (otherwise known as Binary) eg: 0110001010110101
  • 4. RAM: The place where applications run. Computers are restrained by memory and 80% of program crashes relate to memory. Disk: This is where applications that are not running reside along with user data. CPU: The processor that runs and executes programs
  • 6. iOS Stack Core OS Core Services Media Coca Touch High Level (Objective C) Low Level (C)
  • 7. Tools Integrated Development Environment (IDE): Xcode (Code Editor) Programming Languages: C, C++, Objective-C and Swift Main Other Programs Instruments, Memory Allocation & Leaks
  • 9. Step 1: Start a new project in Xcode Step 2: Navigate to the App Delegate.m file Step 3: Add the following code: Step 4: Build and Run!
  • 11. Variables: Variables are a container that holds some kind of value. for example: int myVar = 1; We now have a variable called myVar and its value is equal to 1;
  • 12. Functions: Functions are the way a system performs some kind of action. These can either return a value or not. Example 1: int myVar = 1; [self myFunction]; (void)myFunction { myVar = 2; } Example 2: int myVar = 1; myVar = [self myFunction]; (int)myFunction { return 2; }
  • 13. Parameters: Parameters are variables passed into a function for it to do some computation with. Example 1: int myVar = 1; int otherNumber = 20; int total = [self addNumbers: myVar and: otherNumber]; (int)addNumbers:(int)firstNumber and:(int)secondNumber { int result = firstNumber + secondNumber; return variable; } total would equal 21.
  • 14. C Programming in 1 Slide Integer Loops Array If Then Switch Struct
  • 15. Preprocessor Processes the source code before it gets compiled. Preprocessor performs a search &replace to all occurrences of the name with its value. Loads all the content of a file into the current file. - Watch out for circular dependancies! Objective-C: Loads all the content of a file into the current file. Automatically handles circular dependanci Compiler Specific instructions. Often used as a way for you to easily navigate the code file.
  • 17. Classes Objective C is object orientated This means the source code is split up into files called clas An Objective C Class has Two Files: A interface file (.h) (otherwise known as a header) A Implementation file (.m) @implementation ViewController @end @interface ViewController : UIViewController @end A Header is the public file. It is where we declare methods and variables for use by other classes The Implementation file is where the logic for the declared methods goes.
  • 18. Objective-C: Sending Messages We want to be able to send messages to a class when tryi The way we do that is like: [myClass doSomething];
  • 19. Objective-C: Sending Messages With Parameters If we want to call a function with Parameters we call: [myClass doSomething: @“aString”];
  • 20. Objective-C: Sending Messages With Multiple Parameters If we want to call a function with Parameters we call: [myClass doSomethingWith This:@“FirstString” andThis:@“SecondString”];
  • 21. Objective-C: Instantiating Objects When we want to use a class we need to create a instance of that class in memory. We do that by calling the classes init method, which stands for instantiate. MyClass *object = [[MyClass alloc]init]; NOTE: we called two methods on this alloc and init. ‘alloc’ is the function that allocates the memory required for the object and then init sets it up.
  • 22. Objective-C: More Classes When we alloc and init a class the system sets us up an instance of our class and then returns a pointer to its location in memory. You can have multiple instances of a class. There are some classes called singletons however. This means that there is only one of them in the application. An example of this is the App Delegate.
  • 23. Objective-C: Singleton Classes This is something you will come across more as you go forward however the main one you will encounter is your AppDelegate. One use of a singleton is if you have a variable that needs to be accused through the app then you would declare it there.
  • 24. Objective-C: Memory Management Since were are allocating memory all over the place we need to clear this up so that other parts of the program can use it. If we don’t its called a memory leak. The good news is that these days Apple has created something called Automatic Reference Counting (ARC) which does this for us. We will cover this more later.
  • 25. Objective-C: Getters / Setters Getters and Setters are fairly self explanatory. They are the methods you would call on your class to get a value or set a value. Example: MyClass *object = [[MyClass alloc]init]; [object setRating:9.5]; double theRating = [object rating];
  • 26. Objective-C: Getters / Setters Interface (.h)
  • 27. Objective-C: Getters / Setters Implementation (.m)
  • 28. Objective-C: Properties More Good News!!! Apple has created something called properties. When you declare on of these in the implementation file it will create the getters and setters behind the scene We’ll look at these in more depth in the next slide but the main thing here is to see how th
  • 29. Objective-C: Properties How do we call a property? We use something called Dot Notation MyClass *object = [[MyClass alloc]init]; object.rating = 9.5;
  • 30. Objective-C: Properties / Memory Ok back to Memory as Promised As promised here is the rest of the memory stuff to get to grips with. With ARC iOS will k This makes our life much easier however we need to help it a bit by telling it what needs An object can have any of the following: Strong Weak Nonatomic Atomic
  • 31. Strong: Keeps the object around as long as the class is alive and pointing to it. Weak: Keeps the object around as long as another object is pointing to it strongly. Objective-C: Properties / Memory II Atomic/ Nonatomic: -atomic is the default, which provides support for using this property in multiple treads (at no extra cost).
  • 32. Objective-C: Foundation Classes In Objective-C we have the same data types as in other lang Common Objective C object types: NSString NSArray NSDictionary NSDate NSNumber NSData Immutable NSMutableString NSMutableArray NSMutableDictionary NSDate NSNumber NSData Mutable
  • 33. Objective-C: Foundation Classes II Each one of the types in objective C have a class associate In those classes are properties such as ‘length’ for NSString As well as Getters and Setters.
  • 34. Inheritance and Polymorphism Inheritance is something that you will encounter at all over ob Its actually more simple that it looks: (known as a parent class). This means that the class has all t
  • 35. Inheritance and Polymorphism Vehicle Car BattleShip Vehicle.h -(void)move -(void)turnLeft -(void)turnRight BattleShip.h -(void)shoot Car.h -(void)Park
  • 36. Inheritance and Polymorphism instance of a class can also be treated as an instance of any
  • 37. Coca-Touch: Model View Controller In iOS the standard way to design your app is using someth It breaks down like this: Model: Data and Business Rules View: User Interface Elements Controller: Behaviour and referee between the model and th
  • 38. Coca-Touch: Model View Controller Model View Controller UI Storyboard ViewController.h Concert.h Model data source could be: File System Database Web Service Core Data
  • 39. Demo
  • 41. • String with format • App Coda • Ray Weinerlich