SlideShare a Scribd company logo
1 of 30
SAY HELLO TO




          iPhone Programming
iWillStudy.com      - Gargi Das, iPhone Geek !
Development Tools       Copyright




   xCode
   Interface Builder
   Instruments
   iPhone simulator
xCode IDE   Copyright
Interface Builder   Copyright
iOS Simulator   Copyright
Instruments   Copyright
Objective C                                        Copyright




   Objective C is simply a super set of c.
   One can easily compile c code using Objective C
    compiler and alternatively the developer can also
    put c code any where in the objective c code.
   Syntax of all non Object Oriented operations are
    similar as C.
   Rest syntax is taken from Smalltalk.
   Everything Happens At Runtime( Every error is just a
    warning).
Objective C Terms                  Copyright




   Messages
   Interface, Implementations &
    Instantiation
   Protocols
   Memory Management
Message Passing                                 Copyright




  C++ Way
(obj->methodName(Parameter))
 Objective C Way

([obj methodName:Parameter])
 Target of the message is always resolved at
   runtime.


    In Objective-C one does not call a method;
               one sends a message
Interfaces 1                                                Copyright




@interface classname : superclassname
{
   // instance variables                 The interface of a class is
}                                       usually defined in a header
                                                     file
+ classMethod1;
+ (return_type)classMethod2;
+ (return_type)classMethod3:(param1_type)param1_varName;

- (return_type)instanceMethod1:(param1_type)param1_varName
andOtherParameter:(param2_type)param2_varName;
-
(return_type)instanceMethod2WithParameter:(param1_type)param1_
varName andOtherParameter:(param2_type)param2_varName;
@end
Interfaces                                                       Copyright




class classname : public superclassname
{
 public:
  // instance variables
                                             The code above is roughly
                                           equivalent to the following C++
 // Class (static) functions
                                                       interface
 static void * classMethod1();
 static return_type classMethod2();
 static return_type classMethod3(param1_type param1_varName);

  // Instance (member) functions
return_type instanceMethod1(param1_type param1_varName, param2_type
param2_varName);
return_type instanceMethod2WithParameter(param1_type param1_varName,
param2_type param2_varName=default);
};
Implementation                                        Copyright




Implementation (method) files normally have the file
  extension .m, which originally signified "messages“

@implementationclassname
+classMethod {
// implementation
}
                              The interface only declares
-instanceMethod {
                            the class interface and not the
// implementation           methods themselves: the actual
}                                code is written in the
@end                              implementation file
Instantiation                                       Copyright




   Object is instantiated by first allocating the memory
    for a new object and then initializing.
   Instantiation with default initializer
     NSArray   *array = [[NSArray alloc] init];
   Or you can use
     NSArray   *array = [NSArray new];
   Instantiation with Custom initializer
     NSArray *array = [[NSArray alloc]
      initWithObjects:@"String1",@"String2",nil];
Protocol                                                                 Copyright




   Polymorphism in c++.
   Two Types:
     Formal  Protocol.
     Informal Protocol.

     Delegates are example of Informal Protocol.

     Interface Classes from c++ are example of Formal
      Protocol.

                                           A formal protocol is similar to
    An informal protocol is a list of
                                        an interface in Java or C#. It is a list
    methods that a class can opt to
                                           of methods that any class can
             implement.
                                             declare itself to implement.
Managing Memory                                                       Copyright




   Basic Fundamentals
   Memory Management Rules
   Passing objects between Methods
   Working with Properties
   Deallocating Object
   Leaks and Static Analyzer

         Rule #1 – If you create an object using alloc or copy, you
         need to free that object.
         Rule #2 – If you didn’t create an object directly, don’t
         attempt to release the memory for the object.
Managing Memory:
Fundamentals                                                    Copyright




   What is memory management?
       “Managing the resources efficiently and effectively”.
   Memory management in other languages.
       In C,C++ we have malloc, calloc and free.
       In other object oriented languages we have Garbage
        Collectors.
   So what is there in Objective C?
       “Retain Count”
       No need to worry about Primitive Data Types
Memory Management:
Rules                                                                 Copyright




   You own any object you create.
       You “create” an object using a method whose name begins with “alloc”
        or “new” or contains “copy”.
       e.g. Alloc
        MyClass *myObject = [[MyClass alloc] init];

        // do your work with myObject

        [myObject release] ;

       e.g. Copy
Memory Management:
Rules                                                                  Copyright




   You can take ownership of an object using retain method.
    NSArray* componentArray = [[self
    cellforIndexPath:indexPath]retain];
    /*
    */
    [componentArray release];
   You must relinquish ownership of objects you own when you’re finished
    with them.
      You relinquish ownership of an object by sending it a release
       message or an autorelease message.
   You must not relinquish ownership of an object you do not own.
    NSString* myString = [NSString stringWithFormat:@"%@",[myItem currentItem]];

    [myString release]; // this is absolutely wrong
Memory Management:
Passing Objects between Methods                                             Copyright




     This is wrong
– (NSArray *)sprockets {

NSArray *array = [[NSArray alloc] initWithObjects:mainSprocket, auxiliarySprocket, nil];

return array;

}
     This is also wrong
    – (NSArray *)sprockets {

     NSArray *array = [[NSArray alloc] initWithObjects:mainSprocket,
                                            auxiliarySprocket,nil];
    [array release];
    return array; // array is invalid here
    }
Memory Management:
        Passing Objects between Methods                                         Copyright




           The right way
    – (NSArray *)sprockets {

    NSArray *array = [NSArray arrayWithObjects:mainSprocket, auxiliarySprocket, nil];

    return array;

    }
           You can also do this
– (NSArray *)sprockets {

NSArray *array = [[NSArray alloc] initWithObjects:mainSprocket, auxiliarySprocket, nil];

return [array autorelease];

}
Working with Properties                    Copyright




   Property Declaration
    @interface myClass:NSObject
    {
      float aValue;
    }

    @property float aValue;

    @end
   @property float aValue is equal to :
    float aValue;
    setValue(float iValue);
Working with Properties                                   Copyright




   Assign
     No  need to worry about Memory here. Just a pointer to
      the object is assigned to variable.
     Self.parentController = controller
   Copy
    self.controlArray = [someOtherArray copy];
    //retain count controlArray = 1, someOtherArray = 1

    [someOtherArray release];
    //we need to release someOtherArray
Deallocating Objects                                   Copyright




   When object’s retain count drops to 0, its memory is
    reclaimed in Cocoa terminology it is “freed” or
    “deallocated.”
   Os does this calling the “dealloc” method.
   e.g.    -(void)dealloc {

                   [myObject1 release];
                   [someContainer release];
                   [super release];
            }
   You should never invoke another object’s dealloc
    method directly.
Installing App in iPhone   Copyright
Installing App in iPhone                            Copyright




   First Thing You need a Apple Developer Account.
   Once you have a account you will have a developer
    portal.
   Using the portal you can generate provisioning files
    for your device (which are nothing but certificates).
   And you need to add that certificate information to
    your application and then install that in the device.
UI Controls                                Copyright




   Button – UIButton
   TextField – UITextField
   Image – UIImage&UIImageView
   Table/Lists – UITableView
   View – UIView
   View Controller – UIViewController
   Navigation -- UINavigationController
Demo App 1                 Copyright




             Hello World
Demo App 2                  Copyright




             Image viewer
Worldis Yours! Play it    Copyright
Be in Touch                                          Copyright




   Event PPTs & Study Material:
    http://iwillstudy.com/event/seminar-on-Learn-iPhone-
    Programming-at-Rajkot-29

   Join us on Facebook: www.facebook.com/iwillstudy

   Ask Questions: www.iwillstudy.com/forum
   Our Blog: http://blog.iwillstudy.com

   Email us:   tech@iwillstudy.com

More Related Content

What's hot

Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Aaron Gustafson
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript ProgrammingSehwan Noh
 
Objective-C Crash Course for Web Developers
Objective-C Crash Course for Web DevelopersObjective-C Crash Course for Web Developers
Objective-C Crash Course for Web DevelopersJoris Verbogt
 
Using Xcore with Xtext
Using Xcore with XtextUsing Xcore with Xtext
Using Xcore with XtextHolger Schill
 
A Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented PhpA Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented PhpMichael Girouard
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming LanguageRaghavan Mohan
 
Ios development
Ios developmentIos development
Ios developmentelnaqah
 
Javascript Basics
Javascript BasicsJavascript Basics
Javascript Basicsmsemenistyi
 
Javascript basic course
Javascript basic courseJavascript basic course
Javascript basic courseTran Khoa
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesAnkit Rastogi
 
The Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony BarcelonaThe Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony BarcelonaMatthias Noback
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScriptFu Cheng
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript TutorialBui Kiet
 
The Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup BelgiumThe Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup BelgiumMatthias Noback
 

What's hot (20)

Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
 
Objective-C Crash Course for Web Developers
Objective-C Crash Course for Web DevelopersObjective-C Crash Course for Web Developers
Objective-C Crash Course for Web Developers
 
The Xtext Grammar Language
The Xtext Grammar LanguageThe Xtext Grammar Language
The Xtext Grammar Language
 
201005 accelerometer and core Location
201005 accelerometer and core Location201005 accelerometer and core Location
201005 accelerometer and core Location
 
Using Xcore with Xtext
Using Xcore with XtextUsing Xcore with Xtext
Using Xcore with Xtext
 
core java
core javacore java
core java
 
Clean coding-practices
Clean coding-practicesClean coding-practices
Clean coding-practices
 
A Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented PhpA Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented Php
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Language
 
Ios development
Ios developmentIos development
Ios development
 
Javascript Basics
Javascript BasicsJavascript Basics
Javascript Basics
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
Javascript basic course
Javascript basic courseJavascript basic course
Javascript basic course
 
Iphone course 1
Iphone course 1Iphone course 1
Iphone course 1
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practices
 
The Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony BarcelonaThe Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony Barcelona
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript Tutorial
 
The Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup BelgiumThe Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup Belgium
 

Viewers also liked

덴마크 사람들처럼 저자강연회 카드뉴스
덴마크 사람들처럼 저자강연회 카드뉴스덴마크 사람들처럼 저자강연회 카드뉴스
덴마크 사람들처럼 저자강연회 카드뉴스승희 박
 
MyMDband for Holocaust Survivors
MyMDband for Holocaust SurvivorsMyMDband for Holocaust Survivors
MyMDband for Holocaust SurvivorsAssaf Luxembourg
 
CV Rob September 2015 versie 2
CV Rob September 2015 versie 2CV Rob September 2015 versie 2
CV Rob September 2015 versie 2Rob Blokland
 
Las 7 disciplinas canónicas y practicas artísticas contemporáneas
Las 7 disciplinas canónicas y practicas artísticas contemporáneasLas 7 disciplinas canónicas y practicas artísticas contemporáneas
Las 7 disciplinas canónicas y practicas artísticas contemporáneasSAYURIPEREZ
 
Materi pkn 1
Materi pkn 1Materi pkn 1
Materi pkn 1Setya Eka
 
Daniel Rinehart Resume-4 (Revised Border)
Daniel Rinehart Resume-4 (Revised Border)Daniel Rinehart Resume-4 (Revised Border)
Daniel Rinehart Resume-4 (Revised Border)Danny Rinehart
 
Lo que aprendí de los animales sobre Educación
Lo que aprendí de los animales sobre EducaciónLo que aprendí de los animales sobre Educación
Lo que aprendí de los animales sobre EducaciónDanny Sayago
 
Retirement Benefit Management in Nigerian Public Services: A Case Study of Na...
Retirement Benefit Management in Nigerian Public Services: A Case Study of Na...Retirement Benefit Management in Nigerian Public Services: A Case Study of Na...
Retirement Benefit Management in Nigerian Public Services: A Case Study of Na...iosrjce
 
IT services at nova
IT services at novaIT services at nova
IT services at novaaaberra
 
METODOLOGÍAS DIDÁCTICAS PARA ALUMNOS DEL SIGLO XXI
METODOLOGÍAS DIDÁCTICAS PARA ALUMNOS DEL SIGLO XXI METODOLOGÍAS DIDÁCTICAS PARA ALUMNOS DEL SIGLO XXI
METODOLOGÍAS DIDÁCTICAS PARA ALUMNOS DEL SIGLO XXI CARMEN VIEJO DÍAZ
 
Lysistrata: Aristotle,Plot,Character,Theme
Lysistrata: Aristotle,Plot,Character,ThemeLysistrata: Aristotle,Plot,Character,Theme
Lysistrata: Aristotle,Plot,Character,ThemeGareth Hill
 

Viewers also liked (14)

덴마크 사람들처럼 저자강연회 카드뉴스
덴마크 사람들처럼 저자강연회 카드뉴스덴마크 사람들처럼 저자강연회 카드뉴스
덴마크 사람들처럼 저자강연회 카드뉴스
 
MyMDband for Holocaust Survivors
MyMDband for Holocaust SurvivorsMyMDband for Holocaust Survivors
MyMDband for Holocaust Survivors
 
CV Rob September 2015 versie 2
CV Rob September 2015 versie 2CV Rob September 2015 versie 2
CV Rob September 2015 versie 2
 
Las 7 disciplinas canónicas y practicas artísticas contemporáneas
Las 7 disciplinas canónicas y practicas artísticas contemporáneasLas 7 disciplinas canónicas y practicas artísticas contemporáneas
Las 7 disciplinas canónicas y practicas artísticas contemporáneas
 
Materi pkn 1
Materi pkn 1Materi pkn 1
Materi pkn 1
 
Problemas normal
Problemas normalProblemas normal
Problemas normal
 
Daniel Rinehart Resume-4 (Revised Border)
Daniel Rinehart Resume-4 (Revised Border)Daniel Rinehart Resume-4 (Revised Border)
Daniel Rinehart Resume-4 (Revised Border)
 
Ley de stoke
Ley de stoke Ley de stoke
Ley de stoke
 
Lo que aprendí de los animales sobre Educación
Lo que aprendí de los animales sobre EducaciónLo que aprendí de los animales sobre Educación
Lo que aprendí de los animales sobre Educación
 
Retirement Benefit Management in Nigerian Public Services: A Case Study of Na...
Retirement Benefit Management in Nigerian Public Services: A Case Study of Na...Retirement Benefit Management in Nigerian Public Services: A Case Study of Na...
Retirement Benefit Management in Nigerian Public Services: A Case Study of Na...
 
IT services at nova
IT services at novaIT services at nova
IT services at nova
 
METODOLOGÍAS DIDÁCTICAS PARA ALUMNOS DEL SIGLO XXI
METODOLOGÍAS DIDÁCTICAS PARA ALUMNOS DEL SIGLO XXI METODOLOGÍAS DIDÁCTICAS PARA ALUMNOS DEL SIGLO XXI
METODOLOGÍAS DIDÁCTICAS PARA ALUMNOS DEL SIGLO XXI
 
Lysistrata: Aristotle,Plot,Character,Theme
Lysistrata: Aristotle,Plot,Character,ThemeLysistrata: Aristotle,Plot,Character,Theme
Lysistrata: Aristotle,Plot,Character,Theme
 
Raul gomez 1
Raul gomez 1Raul gomez 1
Raul gomez 1
 

Similar to iPhone Seminar Part 2

The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014Matthias Noback
 
A brief overview of java frameworks
A brief overview of java frameworksA brief overview of java frameworks
A brief overview of java frameworksMD Sayem Ahmed
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
Python mocking intro
Python mocking introPython mocking intro
Python mocking introHans Jones
 
Intro to iOS Development • Made by Many
Intro to iOS Development • Made by ManyIntro to iOS Development • Made by Many
Intro to iOS Development • Made by Manykenatmxm
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programmingNeelesh Shukla
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer ProgrammingInocentshuja Ahmad
 
Cocoa for Web Developers
Cocoa for Web DevelopersCocoa for Web Developers
Cocoa for Web Developersgeorgebrock
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1stConnex
 
object oriented programming using java, second sem BCA,UoM
object oriented programming using java, second sem BCA,UoMobject oriented programming using java, second sem BCA,UoM
object oriented programming using java, second sem BCA,UoMambikavenkatesh2
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Workhorse Computing
 

Similar to iPhone Seminar Part 2 (20)

Objective c
Objective cObjective c
Objective c
 
Chapter iii(oop)
Chapter iii(oop)Chapter iii(oop)
Chapter iii(oop)
 
Java notes
Java notesJava notes
Java notes
 
iOS Application Development
iOS Application DevelopmentiOS Application Development
iOS Application Development
 
The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014
 
iOS Session-2
iOS Session-2iOS Session-2
iOS Session-2
 
Java Basics
Java BasicsJava Basics
Java Basics
 
C# Unit 2 notes
C# Unit 2 notesC# Unit 2 notes
C# Unit 2 notes
 
A brief overview of java frameworks
A brief overview of java frameworksA brief overview of java frameworks
A brief overview of java frameworks
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
Python mocking intro
Python mocking introPython mocking intro
Python mocking intro
 
Intro to iOS Development • Made by Many
Intro to iOS Development • Made by ManyIntro to iOS Development • Made by Many
Intro to iOS Development • Made by Many
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer Programming
 
Cocoa for Web Developers
Cocoa for Web DevelopersCocoa for Web Developers
Cocoa for Web Developers
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1st
 
object oriented programming using java, second sem BCA,UoM
object oriented programming using java, second sem BCA,UoMobject oriented programming using java, second sem BCA,UoM
object oriented programming using java, second sem BCA,UoM
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.
 
Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
 
Mca 504 dotnet_unit3
Mca 504 dotnet_unit3Mca 504 dotnet_unit3
Mca 504 dotnet_unit3
 

More from NAILBITER

Social Media Strategies
Social Media StrategiesSocial Media Strategies
Social Media StrategiesNAILBITER
 
jQuery for Beginners
jQuery for Beginners jQuery for Beginners
jQuery for Beginners NAILBITER
 
GBGahmedabad - Create your Business Website
GBGahmedabad - Create your Business WebsiteGBGahmedabad - Create your Business Website
GBGahmedabad - Create your Business WebsiteNAILBITER
 
Mapathon 2013 - Google Maps Javascript API
Mapathon 2013 - Google Maps Javascript APIMapathon 2013 - Google Maps Javascript API
Mapathon 2013 - Google Maps Javascript APINAILBITER
 
Cloud Workshop - Presentation
Cloud Workshop - PresentationCloud Workshop - Presentation
Cloud Workshop - PresentationNAILBITER
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud ComputingNAILBITER
 
iWillStudy.com - Light Pitch
iWillStudy.com - Light PitchiWillStudy.com - Light Pitch
iWillStudy.com - Light PitchNAILBITER
 
Cloud Summit Ahmedabad
Cloud Summit AhmedabadCloud Summit Ahmedabad
Cloud Summit AhmedabadNAILBITER
 
Android Fundamentals & Figures of 2012
Android Fundamentals & Figures of 2012Android Fundamentals & Figures of 2012
Android Fundamentals & Figures of 2012NAILBITER
 
The iPhone development on windows
The iPhone development on windowsThe iPhone development on windows
The iPhone development on windowsNAILBITER
 
Ambastha EduTech Pvt Ltd
Ambastha EduTech Pvt LtdAmbastha EduTech Pvt Ltd
Ambastha EduTech Pvt LtdNAILBITER
 
Develop open source search engine
Develop open source search engineDevelop open source search engine
Develop open source search engineNAILBITER
 
Location based solutions maps & your location
Location based solutions   maps & your locationLocation based solutions   maps & your location
Location based solutions maps & your locationNAILBITER
 
Html5 workshop part 1
Html5 workshop part 1Html5 workshop part 1
Html5 workshop part 1NAILBITER
 
Android Workshop - Session 2
Android Workshop - Session 2Android Workshop - Session 2
Android Workshop - Session 2NAILBITER
 
Android Workshop Session 1
Android Workshop Session 1Android Workshop Session 1
Android Workshop Session 1NAILBITER
 
Linux Seminar for Beginners
Linux Seminar for BeginnersLinux Seminar for Beginners
Linux Seminar for BeginnersNAILBITER
 
Linux advanced concepts - Part 2
Linux advanced concepts - Part 2Linux advanced concepts - Part 2
Linux advanced concepts - Part 2NAILBITER
 

More from NAILBITER (20)

Social Media Strategies
Social Media StrategiesSocial Media Strategies
Social Media Strategies
 
jQuery for Beginners
jQuery for Beginners jQuery for Beginners
jQuery for Beginners
 
GBGahmedabad - Create your Business Website
GBGahmedabad - Create your Business WebsiteGBGahmedabad - Create your Business Website
GBGahmedabad - Create your Business Website
 
Mapathon 2013 - Google Maps Javascript API
Mapathon 2013 - Google Maps Javascript APIMapathon 2013 - Google Maps Javascript API
Mapathon 2013 - Google Maps Javascript API
 
Cloud Workshop - Presentation
Cloud Workshop - PresentationCloud Workshop - Presentation
Cloud Workshop - Presentation
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
iWillStudy.com - Light Pitch
iWillStudy.com - Light PitchiWillStudy.com - Light Pitch
iWillStudy.com - Light Pitch
 
Cloud Summit Ahmedabad
Cloud Summit AhmedabadCloud Summit Ahmedabad
Cloud Summit Ahmedabad
 
Android Fundamentals & Figures of 2012
Android Fundamentals & Figures of 2012Android Fundamentals & Figures of 2012
Android Fundamentals & Figures of 2012
 
The iPhone development on windows
The iPhone development on windowsThe iPhone development on windows
The iPhone development on windows
 
Ambastha EduTech Pvt Ltd
Ambastha EduTech Pvt LtdAmbastha EduTech Pvt Ltd
Ambastha EduTech Pvt Ltd
 
Branding
BrandingBranding
Branding
 
Advertising
AdvertisingAdvertising
Advertising
 
Develop open source search engine
Develop open source search engineDevelop open source search engine
Develop open source search engine
 
Location based solutions maps & your location
Location based solutions   maps & your locationLocation based solutions   maps & your location
Location based solutions maps & your location
 
Html5 workshop part 1
Html5 workshop part 1Html5 workshop part 1
Html5 workshop part 1
 
Android Workshop - Session 2
Android Workshop - Session 2Android Workshop - Session 2
Android Workshop - Session 2
 
Android Workshop Session 1
Android Workshop Session 1Android Workshop Session 1
Android Workshop Session 1
 
Linux Seminar for Beginners
Linux Seminar for BeginnersLinux Seminar for Beginners
Linux Seminar for Beginners
 
Linux advanced concepts - Part 2
Linux advanced concepts - Part 2Linux advanced concepts - Part 2
Linux advanced concepts - Part 2
 

Recently uploaded

4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 

Recently uploaded (20)

4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 

iPhone Seminar Part 2

  • 1. SAY HELLO TO iPhone Programming iWillStudy.com - Gargi Das, iPhone Geek !
  • 2. Development Tools Copyright  xCode  Interface Builder  Instruments  iPhone simulator
  • 3. xCode IDE Copyright
  • 4. Interface Builder Copyright
  • 5. iOS Simulator Copyright
  • 6. Instruments Copyright
  • 7. Objective C Copyright  Objective C is simply a super set of c.  One can easily compile c code using Objective C compiler and alternatively the developer can also put c code any where in the objective c code.  Syntax of all non Object Oriented operations are similar as C.  Rest syntax is taken from Smalltalk.  Everything Happens At Runtime( Every error is just a warning).
  • 8. Objective C Terms Copyright  Messages  Interface, Implementations & Instantiation  Protocols  Memory Management
  • 9. Message Passing Copyright  C++ Way (obj->methodName(Parameter))  Objective C Way ([obj methodName:Parameter])  Target of the message is always resolved at runtime. In Objective-C one does not call a method; one sends a message
  • 10. Interfaces 1 Copyright @interface classname : superclassname { // instance variables The interface of a class is } usually defined in a header file + classMethod1; + (return_type)classMethod2; + (return_type)classMethod3:(param1_type)param1_varName; - (return_type)instanceMethod1:(param1_type)param1_varName andOtherParameter:(param2_type)param2_varName; - (return_type)instanceMethod2WithParameter:(param1_type)param1_ varName andOtherParameter:(param2_type)param2_varName; @end
  • 11. Interfaces Copyright class classname : public superclassname { public: // instance variables The code above is roughly equivalent to the following C++ // Class (static) functions interface static void * classMethod1(); static return_type classMethod2(); static return_type classMethod3(param1_type param1_varName); // Instance (member) functions return_type instanceMethod1(param1_type param1_varName, param2_type param2_varName); return_type instanceMethod2WithParameter(param1_type param1_varName, param2_type param2_varName=default); };
  • 12. Implementation Copyright Implementation (method) files normally have the file extension .m, which originally signified "messages“ @implementationclassname +classMethod { // implementation } The interface only declares -instanceMethod { the class interface and not the // implementation methods themselves: the actual } code is written in the @end implementation file
  • 13. Instantiation Copyright  Object is instantiated by first allocating the memory for a new object and then initializing.  Instantiation with default initializer  NSArray *array = [[NSArray alloc] init];  Or you can use  NSArray *array = [NSArray new];  Instantiation with Custom initializer  NSArray *array = [[NSArray alloc] initWithObjects:@"String1",@"String2",nil];
  • 14. Protocol Copyright  Polymorphism in c++.  Two Types:  Formal Protocol.  Informal Protocol.  Delegates are example of Informal Protocol.  Interface Classes from c++ are example of Formal Protocol. A formal protocol is similar to An informal protocol is a list of an interface in Java or C#. It is a list methods that a class can opt to of methods that any class can implement. declare itself to implement.
  • 15. Managing Memory Copyright  Basic Fundamentals  Memory Management Rules  Passing objects between Methods  Working with Properties  Deallocating Object  Leaks and Static Analyzer Rule #1 – If you create an object using alloc or copy, you need to free that object. Rule #2 – If you didn’t create an object directly, don’t attempt to release the memory for the object.
  • 16. Managing Memory: Fundamentals Copyright  What is memory management?  “Managing the resources efficiently and effectively”.  Memory management in other languages.  In C,C++ we have malloc, calloc and free.  In other object oriented languages we have Garbage Collectors.  So what is there in Objective C?  “Retain Count”  No need to worry about Primitive Data Types
  • 17. Memory Management: Rules Copyright  You own any object you create.  You “create” an object using a method whose name begins with “alloc” or “new” or contains “copy”.  e.g. Alloc MyClass *myObject = [[MyClass alloc] init]; // do your work with myObject [myObject release] ;  e.g. Copy
  • 18. Memory Management: Rules Copyright  You can take ownership of an object using retain method. NSArray* componentArray = [[self cellforIndexPath:indexPath]retain]; /* */ [componentArray release];  You must relinquish ownership of objects you own when you’re finished with them.  You relinquish ownership of an object by sending it a release message or an autorelease message.  You must not relinquish ownership of an object you do not own. NSString* myString = [NSString stringWithFormat:@"%@",[myItem currentItem]]; [myString release]; // this is absolutely wrong
  • 19. Memory Management: Passing Objects between Methods Copyright  This is wrong – (NSArray *)sprockets { NSArray *array = [[NSArray alloc] initWithObjects:mainSprocket, auxiliarySprocket, nil]; return array; }  This is also wrong – (NSArray *)sprockets { NSArray *array = [[NSArray alloc] initWithObjects:mainSprocket, auxiliarySprocket,nil]; [array release]; return array; // array is invalid here }
  • 20. Memory Management: Passing Objects between Methods Copyright  The right way – (NSArray *)sprockets { NSArray *array = [NSArray arrayWithObjects:mainSprocket, auxiliarySprocket, nil]; return array; }  You can also do this – (NSArray *)sprockets { NSArray *array = [[NSArray alloc] initWithObjects:mainSprocket, auxiliarySprocket, nil]; return [array autorelease]; }
  • 21. Working with Properties Copyright  Property Declaration @interface myClass:NSObject { float aValue; } @property float aValue; @end  @property float aValue is equal to : float aValue; setValue(float iValue);
  • 22. Working with Properties Copyright  Assign  No need to worry about Memory here. Just a pointer to the object is assigned to variable. Self.parentController = controller  Copy self.controlArray = [someOtherArray copy]; //retain count controlArray = 1, someOtherArray = 1 [someOtherArray release]; //we need to release someOtherArray
  • 23. Deallocating Objects Copyright  When object’s retain count drops to 0, its memory is reclaimed in Cocoa terminology it is “freed” or “deallocated.”  Os does this calling the “dealloc” method.  e.g. -(void)dealloc { [myObject1 release]; [someContainer release]; [super release]; }  You should never invoke another object’s dealloc method directly.
  • 24. Installing App in iPhone Copyright
  • 25. Installing App in iPhone Copyright  First Thing You need a Apple Developer Account.  Once you have a account you will have a developer portal.  Using the portal you can generate provisioning files for your device (which are nothing but certificates).  And you need to add that certificate information to your application and then install that in the device.
  • 26. UI Controls Copyright  Button – UIButton  TextField – UITextField  Image – UIImage&UIImageView  Table/Lists – UITableView  View – UIView  View Controller – UIViewController  Navigation -- UINavigationController
  • 27. Demo App 1 Copyright Hello World
  • 28. Demo App 2 Copyright Image viewer
  • 29. Worldis Yours! Play it  Copyright
  • 30. Be in Touch Copyright  Event PPTs & Study Material: http://iwillstudy.com/event/seminar-on-Learn-iPhone- Programming-at-Rajkot-29  Join us on Facebook: www.facebook.com/iwillstudy  Ask Questions: www.iwillstudy.com/forum  Our Blog: http://blog.iwillstudy.com  Email us: tech@iwillstudy.com