SlideShare une entreprise Scribd logo
1  sur  48
iOS Development

Md. Shakil Ahmed
Software Engineer
Astha it research & consultancy ltd.
Dhaka, Bangladesh


16th October 2011
Introduction
Topic Focus:
- What is iOS & iOS Development?
- iOS Dvelopment tools
- Creating a new iOS application.
- Getting Familiar with Xcode and iOS SDK
- Delegate
- Objective C
- Memory Management
- Crash Reports
- iPhone frameworks
What is iOS & iOS Development?
• iOS stands for iPhone Operating System
• iOS made for iPhone, iPod Touch & iPad
• iOS development is developing applications
  for iOS Devices.
iOS Application
There is three ways to do mobile applications
• Mobile Web Interface
• Develop by Flash
• Develop by the native platform
Mobile Web Applications
• This application is mostly connected, so
  most of the time user can’t handle it
  without internet or cached history
• Javascript provides reach function to
  access some hardware like GPS and other
  devices specific hardware
• Developer doesn’t have much authority
  over the device, tied by the browser.
Flash
• Can be used if the application is all about
  interface
• currently flash can be used to act like real
  application, it has access to camera, GPS...
  Etc
• Performance in not good like the native
  platform.
Native Applications
• You can do what ever you want to do, except
  what the framework doesn’t allow you to do.
Smartphone OS Market Share, Q4
            2010
Needed to develop for iPhone
•   Knowledge of Objective C
•   Mac OS X Intel based machine
•   iPhone Development tools
•   iPhone or iPod touch
iPhone Development tools
• Xcode
Create New Application
1. Open Xcode.
2. Select File→New Project.
3. In the dialog that opens, select iPhone OS, then
   View-Based Application and click Choose.
4. Name the project “HelloWorld” and click Save.
5. At this point, you can build and run (click the
   Build and Go icon in the toolbar). The HelloWorld
   application shows only a blank gray screen when
   run in the Simulator.
Create New Application
Xcode
Xcode
• Compiled Code ->
  your's and
  framework's
• Nib – files: UI---
  elements
• Resources: images,
  sounds.
• Info.plist – file: app
  configuraIon
info.plist
Info.plist in Xcode
nib---file?
• Interface Builder is used for creating Uis
• The interface is stored in a file .n/xib
   – .nib = Next Interface Builder
  – .xib = new version (Interface Builder 3) of
  nib
• The xib file is xml!
nib---file
Nib – files in Interface Builder
icons and images
Life Cycle
Design Pattern: Delegate
• Xcode project template has provided
  UIApplicaIonDelegate for you
• Can implement:
  - applicationDidFinishLaunching
  - applicationWillTerminate
  – applicationDidReceiveMemoryWarning
• One object sends periodically messages to
  another object specified as its delegate
Delegate
#import <UIKit/UIKit.h>
@interface HelloWorldAppDelegate : NSObject
    <UIApplicationDelegate> {
UIWindow *window;
UITextField *mytextfield;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITextField
    *mytextfield;
- (IBAction) userClicked: (id) sender;
@end
Delegate
• nonatomic - single threaded application
• retain - memory management
• IBOutlet - variables to attach to Interface
  Builder objects
• IBAction - methods to attach to Interface
  Builder actions
In Interface Builder
Delegate classes implementation
#import "HelloWorldAppDelegate.h"
@implementation HelloWorldAppDelegate
@synthesize window;
@synthesize mytextfield;
- (IBAction) userClicked: (id) sender
{
NSString* text = [mytextfield text];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello“
    message:text delegate:nil cancelButtonTitle:@"Ok“
    otherButtonTitles:nil];
[alert show];
[alert release];
}
Delegate classes implementation
- (void)applicationDidFinishLaunching:(UIApplication
   *)application {
// Override point for customization after application
   launch
[window makeKeyAndVisible];
}
- (void)dealloc {
[window release];
[super dealloc];
}
@end
Result
Objective C
• You can consider it Extension for C language
• ObjC add more dynamicity to C Language
• Single inheritance from super class and
  protocols is used as interfaces
• Totally new syntax but still can use C with it.
Objective C
New concepts
  – Class definition
  – Protocol implementation
  – Class messages
  – Many more …
Classes and Objects
• Classes declare the state and behavior
• State (class data) is instance variables
• Behavior is methods
Class and instance methods
• Instances responds to “Instance methods”
  1. -(id)init;
  2. -(char*)getName;
• Class responds to “Static methods”
  1. +(id)alloc;
  2. +(char*)getClassName;
Message syntax (calling methods)
• Function calling in Objective C called message,
  this is to give more dynamicity to the language,
  some times if the method is not implemented the
  calling result will be nil = null
  – [objectOfClass functionName];
  – [objectOfClass functionName:Arg1];
• Calling staic method
  – [Class functionName];
  – [Class functionName:Arg1];
Objective C
• Dot Syntax
  – It is only working in Objective C 2.0
  – It is only used for properties of object
• Dynamic Casting
  – Using type “id” , id is pointer to void “C Style
    void*”
  – id object = [Class new];
• Static casting
  – Class* object = [Class new];
Objective C
•   nil is equivalents to null
•   Objective C Class has no operators overloading
•   Objective C Class has no constructors or destructors
•   Boolean type is, BOOL
     – YES is TRUE
     – NO is FALSE
Memory Management
Rules :
You only release or autorelease objects you
  own.
• If you own the object by alloc, copy or retain,
  you have to release or autorelease
• If the object is not owned by you, don’t call
  release or autorelease
Memory Management
Memory Management
Local Variable
• Always release or autorelease in the same
  scope
Crash Reports
Crash Types
•   EXC_BAD_ACCESS (SIGBUS or SIGSEGV)
•   EXC_CRASH (SIGABRT)
•   Low Memory
•   00000020
iPhone frameworks
•   Foundation          MapKit
•   UIKit               IOKit
•   CoreGrphics
                        MediaPlayer
•   CFNetwork
                        AddressBook
•   CoreLocation
                        MobileCoreSerivces
•   CoreData
•   ExternalAccessory   OpenGL

•   GameKit             Security

                        StoreKit
                                      And many more
CoreData
Core Location & MapKit
Multitasking
• Available in iOS 4.
iPhone Development
• It is true that Objective C is not as strong as
  any other language but the huge coverage of
  frameworks that is provided by Apple makes it
  Ok to use such SDK.
Thanks!

Contenu connexe

Tendances

iOS Application Lifecycle
iOS Application LifecycleiOS Application Lifecycle
iOS Application Lifecycle
Siva Prasad K V
 
Android activity
Android activityAndroid activity
Android activity
Krazy Koder
 

Tendances (20)

Introduction to flutter
Introduction to flutter Introduction to flutter
Introduction to flutter
 
Basic iOS Training with SWIFT - Part 1
Basic iOS Training with SWIFT - Part 1Basic iOS Training with SWIFT - Part 1
Basic iOS Training with SWIFT - Part 1
 
Introduction to Android ppt
Introduction to Android pptIntroduction to Android ppt
Introduction to Android ppt
 
INTRODUCTION TO FLUTTER BASICS.pptx
INTRODUCTION TO FLUTTER BASICS.pptxINTRODUCTION TO FLUTTER BASICS.pptx
INTRODUCTION TO FLUTTER BASICS.pptx
 
Native, Hybrid, or Cross-platform Development? What Type of Mobile App is Bes...
Native, Hybrid, or Cross-platform Development? What Type of Mobile App is Bes...Native, Hybrid, or Cross-platform Development? What Type of Mobile App is Bes...
Native, Hybrid, or Cross-platform Development? What Type of Mobile App is Bes...
 
Net framework
Net frameworkNet framework
Net framework
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete project
 
iOS Application Lifecycle
iOS Application LifecycleiOS Application Lifecycle
iOS Application Lifecycle
 
React native
React nativeReact native
React native
 
Flutter
FlutterFlutter
Flutter
 
React Native
React NativeReact Native
React Native
 
React native
React nativeReact native
React native
 
Building iOS App Project & Architecture
Building iOS App Project & ArchitectureBuilding iOS App Project & Architecture
Building iOS App Project & Architecture
 
Android activity
Android activityAndroid activity
Android activity
 
Low Level View of Android System Architecture
Low Level View of Android System ArchitectureLow Level View of Android System Architecture
Low Level View of Android System Architecture
 
Introduction to Flutter
Introduction to FlutterIntroduction to Flutter
Introduction to Flutter
 
Basic android-ppt
Basic android-pptBasic android-ppt
Basic android-ppt
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android Studio
 
Flutter
FlutterFlutter
Flutter
 
Angular introduction students
Angular introduction studentsAngular introduction students
Angular introduction students
 

En vedette

En vedette (9)

The Race to the Middle
The Race to the MiddleThe Race to the Middle
The Race to the Middle
 
Maven basics (Android & IntelliJ)
Maven basics (Android & IntelliJ)Maven basics (Android & IntelliJ)
Maven basics (Android & IntelliJ)
 
Data perisistence in iOS
Data perisistence in iOSData perisistence in iOS
Data perisistence in iOS
 
First Steps in iOS Development
First Steps in iOS DevelopmentFirst Steps in iOS Development
First Steps in iOS Development
 
How & where to start iOS development?
How & where to start iOS development?How & where to start iOS development?
How & where to start iOS development?
 
CoreData - there is an ORM you can like!
CoreData - there is an ORM you can like!CoreData - there is an ORM you can like!
CoreData - there is an ORM you can like!
 
Core Data without headaches
Core Data without headachesCore Data without headaches
Core Data without headaches
 
Intro to iOS Development
Intro to iOS DevelopmentIntro to iOS Development
Intro to iOS Development
 
iOS 10 & XCode 8, Swift 3.0 features and changes
iOS 10 & XCode 8, Swift 3.0 features and changesiOS 10 & XCode 8, Swift 3.0 features and changes
iOS 10 & XCode 8, Swift 3.0 features and changes
 

Similaire à Ios development

Ruxmon April 2014 - Introduction to iOS Penetration Testing
Ruxmon April 2014 - Introduction to iOS Penetration TestingRuxmon April 2014 - Introduction to iOS Penetration Testing
Ruxmon April 2014 - Introduction to iOS Penetration Testing
eightbit
 
Introduction to iOS Development
Introduction to iOS DevelopmentIntroduction to iOS Development
Introduction to iOS Development
Asim Rais Siddiqui
 
Xcode, Basics and Beyond
Xcode, Basics and BeyondXcode, Basics and Beyond
Xcode, Basics and Beyond
rsebbe
 
OWASP Melbourne - Introduction to iOS Application Penetration Testing
OWASP Melbourne - Introduction to iOS Application Penetration TestingOWASP Melbourne - Introduction to iOS Application Penetration Testing
OWASP Melbourne - Introduction to iOS Application Penetration Testing
eightbit
 
I Phone Development Presentation
I Phone Development PresentationI Phone Development Presentation
I Phone Development Presentation
Aessam
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS Basics
Petr Dvorak
 

Similaire à Ios development (20)

iOS Development Survival Guide for the .NET Guy
iOS Development Survival Guide for the .NET GuyiOS Development Survival Guide for the .NET Guy
iOS Development Survival Guide for the .NET Guy
 
Image Processing and Computer Vision in iPhone and iPad
Image Processing and Computer Vision in iPhone and iPadImage Processing and Computer Vision in iPhone and iPad
Image Processing and Computer Vision in iPhone and iPad
 
Ruxmon April 2014 - Introduction to iOS Penetration Testing
Ruxmon April 2014 - Introduction to iOS Penetration TestingRuxmon April 2014 - Introduction to iOS Penetration Testing
Ruxmon April 2014 - Introduction to iOS Penetration Testing
 
Introduction to iOS Development
Introduction to iOS DevelopmentIntroduction to iOS Development
Introduction to iOS Development
 
Xcode, Basics and Beyond
Xcode, Basics and BeyondXcode, Basics and Beyond
Xcode, Basics and Beyond
 
iOS Development - Offline Class for Jasakomer
iOS Development - Offline Class for JasakomeriOS Development - Offline Class for Jasakomer
iOS Development - Offline Class for Jasakomer
 
C# on the iPhone with MonoTouch Glasgow
C# on the iPhone with MonoTouch GlasgowC# on the iPhone with MonoTouch Glasgow
C# on the iPhone with MonoTouch Glasgow
 
OWASP Melbourne - Introduction to iOS Application Penetration Testing
OWASP Melbourne - Introduction to iOS Application Penetration TestingOWASP Melbourne - Introduction to iOS Application Penetration Testing
OWASP Melbourne - Introduction to iOS Application Penetration Testing
 
Никита Корчагин - Introduction to Apple iOS Development.
Никита Корчагин - Introduction to Apple iOS Development.Никита Корчагин - Introduction to Apple iOS Development.
Никита Корчагин - Introduction to Apple iOS Development.
 
Italian Alt.Net Conference MonoTouch Session
Italian Alt.Net Conference MonoTouch SessionItalian Alt.Net Conference MonoTouch Session
Italian Alt.Net Conference MonoTouch Session
 
Introduction to Android Development and Security
Introduction to Android Development and SecurityIntroduction to Android Development and Security
Introduction to Android Development and Security
 
Enterprise iPad Development Without Notes
Enterprise iPad Development Without NotesEnterprise iPad Development Without Notes
Enterprise iPad Development Without Notes
 
I Phone Development Presentation
I Phone Development PresentationI Phone Development Presentation
I Phone Development Presentation
 
Java- Java tech overview- Mazenet solution
Java- Java tech overview- Mazenet solutionJava- Java tech overview- Mazenet solution
Java- Java tech overview- Mazenet solution
 
Exploring Your Apple M1 devices with Open Source Tools
Exploring Your Apple M1 devices with Open Source ToolsExploring Your Apple M1 devices with Open Source Tools
Exploring Your Apple M1 devices with Open Source Tools
 
Bootstrapping iPhone Development
Bootstrapping iPhone DevelopmentBootstrapping iPhone Development
Bootstrapping iPhone Development
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
 
iOS Application Exploitation
iOS Application ExploitationiOS Application Exploitation
iOS Application Exploitation
 
C# On The iPhone with MonoTouch at DDD8
C# On The iPhone with MonoTouch at DDD8C# On The iPhone with MonoTouch at DDD8
C# On The iPhone with MonoTouch at DDD8
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS Basics
 

Plus de Shakil Ahmed (20)

Algorithm
AlgorithmAlgorithm
Algorithm
 
B-tree & R-tree
B-tree & R-treeB-tree & R-tree
B-tree & R-tree
 
Advanced data structure
Advanced data structureAdvanced data structure
Advanced data structure
 
Prototype pattern
Prototype patternPrototype pattern
Prototype pattern
 
Observer pattern
Observer patternObserver pattern
Observer pattern
 
Mediator pattern
Mediator patternMediator pattern
Mediator pattern
 
Flyweight pattern
Flyweight patternFlyweight pattern
Flyweight pattern
 
Facade pattern
Facade patternFacade pattern
Facade pattern
 
Composite pattern
Composite patternComposite pattern
Composite pattern
 
Command pattern
Command patternCommand pattern
Command pattern
 
Chain of responsibility
Chain of responsibilityChain of responsibility
Chain of responsibility
 
Builder pattern
Builder patternBuilder pattern
Builder pattern
 
Bridge pattern
Bridge patternBridge pattern
Bridge pattern
 
Adapter pattern
Adapter patternAdapter pattern
Adapter pattern
 
Proxy pattern
Proxy patternProxy pattern
Proxy pattern
 
iOS 5
iOS 5iOS 5
iOS 5
 
Graph
GraphGraph
Graph
 
Lowest common ancestor
Lowest common ancestorLowest common ancestor
Lowest common ancestor
 
Segment tree
Segment treeSegment tree
Segment tree
 
Tree & bst
Tree & bstTree & bst
Tree & bst
 

Dernier

Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Dernier (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 

Ios development

  • 1. iOS Development Md. Shakil Ahmed Software Engineer Astha it research & consultancy ltd. Dhaka, Bangladesh 16th October 2011
  • 2. Introduction Topic Focus: - What is iOS & iOS Development? - iOS Dvelopment tools - Creating a new iOS application. - Getting Familiar with Xcode and iOS SDK - Delegate - Objective C - Memory Management - Crash Reports - iPhone frameworks
  • 3. What is iOS & iOS Development? • iOS stands for iPhone Operating System • iOS made for iPhone, iPod Touch & iPad • iOS development is developing applications for iOS Devices.
  • 4. iOS Application There is three ways to do mobile applications • Mobile Web Interface • Develop by Flash • Develop by the native platform
  • 5. Mobile Web Applications • This application is mostly connected, so most of the time user can’t handle it without internet or cached history • Javascript provides reach function to access some hardware like GPS and other devices specific hardware • Developer doesn’t have much authority over the device, tied by the browser.
  • 6. Flash • Can be used if the application is all about interface • currently flash can be used to act like real application, it has access to camera, GPS... Etc • Performance in not good like the native platform.
  • 7. Native Applications • You can do what ever you want to do, except what the framework doesn’t allow you to do.
  • 8. Smartphone OS Market Share, Q4 2010
  • 9.
  • 10.
  • 11. Needed to develop for iPhone • Knowledge of Objective C • Mac OS X Intel based machine • iPhone Development tools • iPhone or iPod touch
  • 13. Create New Application 1. Open Xcode. 2. Select File→New Project. 3. In the dialog that opens, select iPhone OS, then View-Based Application and click Choose. 4. Name the project “HelloWorld” and click Save. 5. At this point, you can build and run (click the Build and Go icon in the toolbar). The HelloWorld application shows only a blank gray screen when run in the Simulator.
  • 15. Xcode
  • 16. Xcode • Compiled Code -> your's and framework's • Nib – files: UI--- elements • Resources: images, sounds. • Info.plist – file: app configuraIon
  • 19. nib---file? • Interface Builder is used for creating Uis • The interface is stored in a file .n/xib – .nib = Next Interface Builder – .xib = new version (Interface Builder 3) of nib • The xib file is xml!
  • 21. Nib – files in Interface Builder
  • 24. Design Pattern: Delegate • Xcode project template has provided UIApplicaIonDelegate for you • Can implement: - applicationDidFinishLaunching - applicationWillTerminate – applicationDidReceiveMemoryWarning • One object sends periodically messages to another object specified as its delegate
  • 25. Delegate #import <UIKit/UIKit.h> @interface HelloWorldAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UITextField *mytextfield; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UITextField *mytextfield; - (IBAction) userClicked: (id) sender; @end
  • 26. Delegate • nonatomic - single threaded application • retain - memory management • IBOutlet - variables to attach to Interface Builder objects • IBAction - methods to attach to Interface Builder actions
  • 28. Delegate classes implementation #import "HelloWorldAppDelegate.h" @implementation HelloWorldAppDelegate @synthesize window; @synthesize mytextfield; - (IBAction) userClicked: (id) sender { NSString* text = [mytextfield text]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello“ message:text delegate:nil cancelButtonTitle:@"Ok“ otherButtonTitles:nil]; [alert show]; [alert release]; }
  • 29. Delegate classes implementation - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after application launch [window makeKeyAndVisible]; } - (void)dealloc { [window release]; [super dealloc]; } @end
  • 31. Objective C • You can consider it Extension for C language • ObjC add more dynamicity to C Language • Single inheritance from super class and protocols is used as interfaces • Totally new syntax but still can use C with it.
  • 32. Objective C New concepts – Class definition – Protocol implementation – Class messages – Many more …
  • 33. Classes and Objects • Classes declare the state and behavior • State (class data) is instance variables • Behavior is methods
  • 34. Class and instance methods • Instances responds to “Instance methods” 1. -(id)init; 2. -(char*)getName; • Class responds to “Static methods” 1. +(id)alloc; 2. +(char*)getClassName;
  • 35. Message syntax (calling methods) • Function calling in Objective C called message, this is to give more dynamicity to the language, some times if the method is not implemented the calling result will be nil = null – [objectOfClass functionName]; – [objectOfClass functionName:Arg1]; • Calling staic method – [Class functionName]; – [Class functionName:Arg1];
  • 36. Objective C • Dot Syntax – It is only working in Objective C 2.0 – It is only used for properties of object • Dynamic Casting – Using type “id” , id is pointer to void “C Style void*” – id object = [Class new]; • Static casting – Class* object = [Class new];
  • 37. Objective C • nil is equivalents to null • Objective C Class has no operators overloading • Objective C Class has no constructors or destructors • Boolean type is, BOOL – YES is TRUE – NO is FALSE
  • 38. Memory Management Rules : You only release or autorelease objects you own. • If you own the object by alloc, copy or retain, you have to release or autorelease • If the object is not owned by you, don’t call release or autorelease
  • 40. Memory Management Local Variable • Always release or autorelease in the same scope
  • 42. Crash Types • EXC_BAD_ACCESS (SIGBUS or SIGSEGV) • EXC_CRASH (SIGABRT) • Low Memory • 00000020
  • 43. iPhone frameworks • Foundation MapKit • UIKit IOKit • CoreGrphics MediaPlayer • CFNetwork AddressBook • CoreLocation MobileCoreSerivces • CoreData • ExternalAccessory OpenGL • GameKit Security StoreKit And many more
  • 45. Core Location & MapKit
  • 47. iPhone Development • It is true that Objective C is not as strong as any other language but the huge coverage of frameworks that is provided by Apple makes it Ok to use such SDK.