SlideShare a Scribd company logo
1 of 85
IPhone Application Development
Week 1
Muhammad Asif Subhani
Assistant Professor
IPhone Application Development
• What is this class all about?
Why am I here?
• Prerequisites
You must be a strong object-oriented
programmer.
• iOS Overview
What’s in iOS?
What will I learn in this course?
• How to build cool apps
Easy to build even very complex applications.
Result lives in your pocket or backpack!
Very easy to distribute your application through the
AppStore. Vibrant development community.
• Real-life Object-Oriented Programming
The heart of Cocoa Touch is 100% object-oriented.
• Application of MVC design model.
• Many computer science concepts applied in a
commercial development platform:
Databases, Graphics, Multimedia, Multithreading,
Animation, Networking, and much, much more!
Prerequisites
• Prior Coursework
Object-Oriented Programming experience mandatory. Structured
Programming and Data Structure.
• You should know well the meaning of these terms ...
Class (description/template for an object)
Instance (manifestation of a class)
Message (sent to object to make it act)
Method (code invoked by a Message)
Instance Variable (object-specific storage)
Superclass/Subclass (Inheritance)
If you are not very comfortable with all of these, this is probably not
the class for you!
• Programming Experience
This is an upper-level CS course. If you have never written a
program where you had to design and implement more than a
handful of classes, this will be a big step up in difficulty for you.
What’s in iOS?
CS193p!
Winter 2015
Cocoa Touch
Media
Core Services
Core OS
Core OS!
OSX Kernel!
Mach 3.0!
BSD!
Socket s!
Securit y
Power Management !
Keychain Access!
Cert ificates!
File System!
Bonj our
What ’s in iOS?
What’s in iOS?
What’s in iOS?
What’s in iOS?
What’s in iOS?
Welcome to Xcode
Welcome to Xcode
Welcome to Xcode
Welcome to Xcode
Welcome to Xcode
Navigator
Welcome to Xcode
Class Hierarchy
Welcome to Xcode
Search in the Project
Welcome to Xcode
Breakpoints in the
Project for Debugging
Welcome to Xcode
Previous Builds.
Welcome to Xcode
This is Controller from
where we would
control our views
Welcome to Xcode
This is our View where
we would design our GUI
Welcome to Xcode
This is our View where
we would design our GUI
with Drag and Drop not
with code.
Welcome to Xcode
Double click on white
area will Zoom Out the
GUI.
Welcome to Xcode
In complex projects, we will have many of such
square areas to design different screens and
applications switch from one screen to another
screen.This area would be like big map.
Welcome to Xcode
This is utilities area.
Welcome to Xcode
This is Object Library. These things
make GUI and consist of lot
of objects.
Let’s make Calculator
To make the Result area of Calculator,
we need a Label whose text would be
updated with the result when we perform
addition, subtraction, multiplication and
Other mathematical functions.
We shall drag and drop that Label on our View area.
Let’s make Calculator
To make the Result area of Calculator,
we need a Label, These Blue lines help
me aligning the placement of Label or
other GUI elements on the View Area.
Let’s make Calculator
To make the Result area of Calculator,
we need a Label, These boxes show that
this Label is selected. You can change
the size of Label by clicking and dragging
side of the box.
Let’s make Calculator
To make the Result area of Calculator,
we need a Label, These boxes show that
this Label is selected. You can change
the size of Label by clicking and dragging
side of the box.
Let’s make Calculator
To make the Result area of Calculator,
we need a Label, You can change the text
Label by double clicking on Label.
Let’s make Calculator
To make the Result area of Calculator,
we need a Label, You have changed the
Text Label to 0 by double clicking on Label.
Let’s make Calculator
To make the Result area of Calculator,
we need a Label, Click on Attributes Inspector.
Then you can change the text alignment of 0
to Right Align.
Let’s make Calculator
To make the Result area of Calculator,
we need a Label, Click on Attributes Inspector.
Then you can change the Font Size of 0
to 32.
Let’s make Calculator
To make the Result area of Calculator,
we need a Label, Click on Lower side of the
Label Box to increase the height of the Label.
Let’s make Calculator
To make the Result area of Calculator,
we need a Label, Click on Lower side of the
Label Box to increase the height of the Label.
Let’s make Calculator
Let’s Run this Application. You can Run
Application on any iOS device attached to
Your computer.
Or Run the Application on any Simulator
listed below.
I don’t have any device currently attached
Therefore it would Run in Iphone 6s Plus
simulator as shown selected in the image.
Let’s make Calculator
Let’s Run this Application. You can Run
Application by Clicking on Play Button.
The application would Run in Iphone 6s Plus
Simulator as shown.
Let’s make Calculator
Now we are in
Simulator, its
loading now..
This is separate
application other
than Xcode.
Let’s make Calculator
Now we are in
Simulator, it would
ask for Proxy
setting if used on
UMT Network.
Let’s make Calculator
Now we are in
Simulator, it would
not show full
screen because my
System resolution
is lower as
compared to
Iphone 6s Plus. So
we can scale down
resolution to 50%.
Let’s make Calculator
Now we are in
Simulator, Now
this shows full
screen without
Scroll on 50%
resolution.
Let’s make Calculator
Now we are in
Simulator, This
would be the
display on Non-
Proxy network.
But this is just
White Screen
Why???????????
Let’s make Calculator
This Label is
present there but
this is Off screen.
See its width.
Its Square.
No iOS device is
Square.
They are Rectangle
in shape each one
has different size
and shape.
Then why we
design in
Square???
Let’s make Calculator
We design
everything in
Square and then
give Rules called
Constraints to
everything inside
square that define
what happen to
them when they
Squished down
horizontally or
vertically.
Let’s make Calculator
Now let us give
some Rules to this
label. That this
should know what
to do when this
Label squished
down in any
direction for any
device.
Let’s make Calculator
Now let us give
some Rules to this
label.
iOS wants us to
use the whole
width available so
we would pin the
right edge of Label
Rectangle to the
Square right edge.
So they will be
always pinned to
each other.
Let’s make Calculator
Now let us give
some Rules to this
label.
How we would pin
right edges
together?
Step 1: First Press
control button
then click and drag
from right edge of
Label to Square
edge as shown in
figure.
Let’s make Calculator
Now let us give
some Rules to this
label.
How we would pin
right edges
together?
Step 2: When you
would release the
mouse click. It
would show the
little black box
that asks which
constraints to
choose from the
list of constraints
Let’s make Calculator
Now let us give
some Rules to this
label.
How we would pin
right edges
together?
This would result
after step 2 is
completed.
Let’s make Calculator
Now let us give
some Rules to this
label.
How we would pin
left edges
together?
Same 2 step
process is
repeated here for
left edges.
Let’s make Calculator
Now let us give
some Rules to this
label.
How we would pin
top edges
together?
Same 2 step
process is
repeated
Let’s make Calculator
Now let us give
some Rules to this
label.
How we would pin
all edges
together?
This would be
result when we
pin right, left and
top. But we didn’t
pin bottom..
Let’s make Calculator
Now let us give
some Rules to this
label.
How we would pin
top edges
together?
Same 2 step
process is
repeated
Let’s make Calculator
You can hide
Navigation and
Utilities area by
pressing these
buttons to have
this view in xcode.
Let’s make Calculator
We don’t need
this code in our
Calculator.
Let’s make Calculator
This is the Basic Class
Declaration code in Swift.
This class ViewController
is being inhereted from its
Superclass
UIViewController class.
Swift has single
inheritance. Means one
class can inheret from only
one class.
Don’t inheret from any
class if you don’t want to.
Let’s make Calculator
We are inheriting from
UIViewController so that
we can get all the
mechanisms of controlling
UI through this class in our
own ViewController class.
We can inheret indirectly
from UIViewController as
well by inhereting from a
class that inherets from
UIView Controller.
Let’s make Calculator
Our own ViewController
class has a very generic
name when you would
make your own
application then you
would have a lot of these
classes and Views so
choose a better name like
CalculatorViewController
that looks more relevant
to your application or any
better name.
Let’s make Calculator
To connect this UI with the
code. We need to make
Instance Variable
(Property) so that we can
update the value of Label
whenever we want by
changing the value of that
Instance variable.
Lets connect UI with
ViewController. First we
would press Control
button and click on Label
and drag it into our class
code.
Let’s make Calculator
By releasing it would ask
what kind of connection
you want to make, We
choose Outlet connection.
Outlet connection is a
instance Variable that
points to this Label in UI.
Lets name it first.
Let’s make Calculator
Lets name it first.
We have named it display.
This would automatically
understand that its type is
UILabel because we made
it by dragging it from Label
to our class.
Let’s make Calculator
This has made an @IBOutlet weak var display: UILabel!
Purpose of @IBOutlet is to make a coonection between
UILabel and your code as shown in gutter.
Weak is for the purpose of Automatic reference
counting (ARC)
Actual Syntax to create a Property or Instance variable
is following
var display: UILabel!
Let’s make Calculator
Now we would put a Button on our
View Screen.
Let’s make Calculator
You can change the size of the button
from Size Inspector.
Let’s make Calculator
We have changed the Button Text to 7
increased its size and Font size of text
on the button and would connect this
button to UI the same way we did to
our Label.
Let’s make Calculator
Press Control button then click on
Button and then drag mouse into the
code then this screen would appear.
Let’s make Calculator
When you would release mouse and
Control button. This screen would
appear with little box that would ask
what would you want to connect.
This time we don’t want IBOutlet, we
want Action so we would select Action
from top drop down menu item.
Let’s make Calculator
This would Ask for the name of the
Action “appendDigit” and change the
Type to “UIButton”
Let’s make Calculator
This would Ask for the name of the
Action “appendDigit” and change the
Type to “UIButton”.
Press Connect button.
Let’s make Calculator
This is the Syntax of the function
definition.
func appendDigit(sender: UIButton)
Let’s make Calculator
If function has return type then its is
written after argument paraenthesis
after arrow sign. As shown in the
figure it is returning the Double.
func appendDigit(sender: UIButton,
display: UILabel) -> Double.
Let’s make Calculator
Let’s make Calculator
Let’s make Calculator
Let’s make Calculator
Let’s make Calculator
Let’s make Calculator
Let’s make Calculator
Let’s make Calculator
Let’s make Calculator
?
Let’s make Calculator
Let’s make Calculator
Let’s make Calculator
Let’s make Calculator
Let’s make Calculator
Will Discuss this in Next
Class.
Thanks

More Related Content

What's hot

Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outletsveeracynixit
 
Beta testing guidelines for developer
Beta testing guidelines for developerBeta testing guidelines for developer
Beta testing guidelines for developerKetan Raval
 
Google calendar integration in iOS app
Google calendar integration in iOS appGoogle calendar integration in iOS app
Google calendar integration in iOS appKetan Raval
 
Automatic reference counting (arc) and memory management in swift
Automatic reference counting (arc) and memory management in swiftAutomatic reference counting (arc) and memory management in swift
Automatic reference counting (arc) and memory management in swiftInnovationM
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentAhsanul Karim
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI WidgetsAhsanul Karim
 
UI Testing for Your Xamarin.Forms Apps
UI Testing for Your Xamarin.Forms AppsUI Testing for Your Xamarin.Forms Apps
UI Testing for Your Xamarin.Forms AppsCodrina Merigo
 
Londroid Android Home Screen Widgets
Londroid Android Home Screen WidgetsLondroid Android Home Screen Widgets
Londroid Android Home Screen WidgetsRichard Hyndman
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
iPhone first App Store submission
iPhone  first App Store submissioniPhone  first App Store submission
iPhone first App Store submissionPragati Singh
 
Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Ahsanul Karim
 
MobileAppDev Handout#2
MobileAppDev Handout#2MobileAppDev Handout#2
MobileAppDev Handout#2trupti1976
 

What's hot (19)

Presentation
PresentationPresentation
Presentation
 
Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outlets
 
Beta testing guidelines for developer
Beta testing guidelines for developerBeta testing guidelines for developer
Beta testing guidelines for developer
 
Google calendar integration in iOS app
Google calendar integration in iOS appGoogle calendar integration in iOS app
Google calendar integration in iOS app
 
Automatic reference counting (arc) and memory management in swift
Automatic reference counting (arc) and memory management in swiftAutomatic reference counting (arc) and memory management in swift
Automatic reference counting (arc) and memory management in swift
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
 
Android UI
Android UIAndroid UI
Android UI
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI Widgets
 
I Phone101
I Phone101I Phone101
I Phone101
 
UI Testing for Your Xamarin.Forms Apps
UI Testing for Your Xamarin.Forms AppsUI Testing for Your Xamarin.Forms Apps
UI Testing for Your Xamarin.Forms Apps
 
Londroid Android Home Screen Widgets
Londroid Android Home Screen WidgetsLondroid Android Home Screen Widgets
Londroid Android Home Screen Widgets
 
android layouts
android layoutsandroid layouts
android layouts
 
iPhone first App Store submission
iPhone  first App Store submissioniPhone  first App Store submission
iPhone first App Store submission
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
 
Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3
 
MobileAppDev Handout#2
MobileAppDev Handout#2MobileAppDev Handout#2
MobileAppDev Handout#2
 
Android development module
Android development moduleAndroid development module
Android development module
 
Using android's action bar
Using android's action barUsing android's action bar
Using android's action bar
 
Android app development guide for freshers by ace web academy
Android app development guide for freshers  by ace web academyAndroid app development guide for freshers  by ace web academy
Android app development guide for freshers by ace web academy
 

Viewers also liked

Viewers also liked (13)

552
552552
552
 
Lindsey coan final ppp
Lindsey coan final pppLindsey coan final ppp
Lindsey coan final ppp
 
ΚΩΣ ,ΤΟ ΝΗΣΙ ΤΟΥ ΗΛΙΟΥ
ΚΩΣ ,ΤΟ ΝΗΣΙ ΤΟΥ ΗΛΙΟΥΚΩΣ ,ΤΟ ΝΗΣΙ ΤΟΥ ΗΛΙΟΥ
ΚΩΣ ,ΤΟ ΝΗΣΙ ΤΟΥ ΗΛΙΟΥ
 
Hola
HolaHola
Hola
 
Razvan voicu fish passage 2015 - agnita and manastur ii+iii
Razvan voicu  fish passage 2015 - agnita and manastur ii+iiiRazvan voicu  fish passage 2015 - agnita and manastur ii+iii
Razvan voicu fish passage 2015 - agnita and manastur ii+iii
 
NJ Family law - Shia Law
NJ Family law - Shia LawNJ Family law - Shia Law
NJ Family law - Shia Law
 
540
540540
540
 
6671
66716671
6671
 
7014
70147014
7014
 
Trabajo final-catedra
Trabajo final-catedraTrabajo final-catedra
Trabajo final-catedra
 
9 safety
9 safety9 safety
9 safety
 
Implementation, Change Management and the Application of Healthcare Analytics
Implementation, Change Management and the Application of Healthcare AnalyticsImplementation, Change Management and the Application of Healthcare Analytics
Implementation, Change Management and the Application of Healthcare Analytics
 
Laura sebu icstcc_merging
Laura sebu icstcc_mergingLaura sebu icstcc_merging
Laura sebu icstcc_merging
 

Similar to IOS Swift language 1st Tutorial

Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outletsveeracynixit
 
Laboratorio: Desarrollo para Smart Devices (continuación)
Laboratorio: Desarrollo para Smart Devices (continuación)Laboratorio: Desarrollo para Smart Devices (continuación)
Laboratorio: Desarrollo para Smart Devices (continuación)GeneXus
 
Programming-In-Alice.pptx
Programming-In-Alice.pptxProgramming-In-Alice.pptx
Programming-In-Alice.pptxCarlos134964
 
How to create ui using droid draw
How to create ui using droid drawHow to create ui using droid draw
How to create ui using droid drawinfo_zybotech
 
Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculatorVlad Kolesnyk
 
Qalcwise Introduction to Designer v20160215
Qalcwise Introduction to Designer v20160215Qalcwise Introduction to Designer v20160215
Qalcwise Introduction to Designer v20160215qalcwise
 
Lab view introduction
Lab view introductionLab view introduction
Lab view introductionJakupBerisha2
 
Raspberry Pi and Physical Computing Workshop
Raspberry Pi and Physical Computing WorkshopRaspberry Pi and Physical Computing Workshop
Raspberry Pi and Physical Computing WorkshopRachel Wang
 
MAD mobile application development you can learn from here , we perform all c...
MAD mobile application development you can learn from here , we perform all c...MAD mobile application development you can learn from here , we perform all c...
MAD mobile application development you can learn from here , we perform all c...harshalpatil183931
 
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger KerseCoding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger KerseEuropean Innovation Academy
 
Appy builder beginner tutorial
Appy builder beginner tutorialAppy builder beginner tutorial
Appy builder beginner tutorialHabibulHakam
 
Create yourfirstandroidapppdf
Create yourfirstandroidapppdfCreate yourfirstandroidapppdf
Create yourfirstandroidapppdfmurad3003
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lecturesmarwaeng
 
App inventor week4(technovation)
App inventor week4(technovation)App inventor week4(technovation)
App inventor week4(technovation)than sare
 
Autocad excel vba
Autocad excel vbaAutocad excel vba
Autocad excel vbarjg_vijay
 
Gui builder
Gui builderGui builder
Gui builderlearnt
 

Similar to IOS Swift language 1st Tutorial (20)

Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outlets
 
Laboratorio: Desarrollo para Smart Devices (continuación)
Laboratorio: Desarrollo para Smart Devices (continuación)Laboratorio: Desarrollo para Smart Devices (continuación)
Laboratorio: Desarrollo para Smart Devices (continuación)
 
Swift
SwiftSwift
Swift
 
Programming-In-Alice.pptx
Programming-In-Alice.pptxProgramming-In-Alice.pptx
Programming-In-Alice.pptx
 
Chapter 2- Prog101.ppt
Chapter 2- Prog101.pptChapter 2- Prog101.ppt
Chapter 2- Prog101.ppt
 
How to create ui using droid draw
How to create ui using droid drawHow to create ui using droid draw
How to create ui using droid draw
 
Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculator
 
Qalcwise Introduction to Designer v20160215
Qalcwise Introduction to Designer v20160215Qalcwise Introduction to Designer v20160215
Qalcwise Introduction to Designer v20160215
 
Lab view introduction
Lab view introductionLab view introduction
Lab view introduction
 
Introduction of Xcode
Introduction of XcodeIntroduction of Xcode
Introduction of Xcode
 
Raspberry Pi and Physical Computing Workshop
Raspberry Pi and Physical Computing WorkshopRaspberry Pi and Physical Computing Workshop
Raspberry Pi and Physical Computing Workshop
 
MAD mobile application development you can learn from here , we perform all c...
MAD mobile application development you can learn from here , we perform all c...MAD mobile application development you can learn from here , we perform all c...
MAD mobile application development you can learn from here , we perform all c...
 
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger KerseCoding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
 
Appy builder beginner tutorial
Appy builder beginner tutorialAppy builder beginner tutorial
Appy builder beginner tutorial
 
Vb%20 tutorial
Vb%20 tutorialVb%20 tutorial
Vb%20 tutorial
 
Create yourfirstandroidapppdf
Create yourfirstandroidapppdfCreate yourfirstandroidapppdf
Create yourfirstandroidapppdf
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
App inventor week4(technovation)
App inventor week4(technovation)App inventor week4(technovation)
App inventor week4(technovation)
 
Autocad excel vba
Autocad excel vbaAutocad excel vba
Autocad excel vba
 
Gui builder
Gui builderGui builder
Gui builder
 

More from Hassan A-j

Warehouse scale computer
Warehouse scale computerWarehouse scale computer
Warehouse scale computerHassan A-j
 
IOS Swift Language 4th tutorial
IOS Swift Language 4th tutorialIOS Swift Language 4th tutorial
IOS Swift Language 4th tutorialHassan A-j
 
IOS Swift Language 3rd tutorial
IOS Swift Language 3rd tutorialIOS Swift Language 3rd tutorial
IOS Swift Language 3rd tutorialHassan A-j
 
IOS Swift language 2nd tutorial
IOS Swift language 2nd tutorialIOS Swift language 2nd tutorial
IOS Swift language 2nd tutorialHassan A-j
 
Software Process Models
Software Process ModelsSoftware Process Models
Software Process ModelsHassan A-j
 
Introduction to MapReduce
Introduction to MapReduceIntroduction to MapReduce
Introduction to MapReduceHassan A-j
 

More from Hassan A-j (6)

Warehouse scale computer
Warehouse scale computerWarehouse scale computer
Warehouse scale computer
 
IOS Swift Language 4th tutorial
IOS Swift Language 4th tutorialIOS Swift Language 4th tutorial
IOS Swift Language 4th tutorial
 
IOS Swift Language 3rd tutorial
IOS Swift Language 3rd tutorialIOS Swift Language 3rd tutorial
IOS Swift Language 3rd tutorial
 
IOS Swift language 2nd tutorial
IOS Swift language 2nd tutorialIOS Swift language 2nd tutorial
IOS Swift language 2nd tutorial
 
Software Process Models
Software Process ModelsSoftware Process Models
Software Process Models
 
Introduction to MapReduce
Introduction to MapReduceIntroduction to MapReduce
Introduction to MapReduce
 

Recently uploaded

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 

Recently uploaded (20)

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
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🔝
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 

IOS Swift language 1st Tutorial

  • 1. IPhone Application Development Week 1 Muhammad Asif Subhani Assistant Professor
  • 2. IPhone Application Development • What is this class all about? Why am I here? • Prerequisites You must be a strong object-oriented programmer. • iOS Overview What’s in iOS?
  • 3. What will I learn in this course? • How to build cool apps Easy to build even very complex applications. Result lives in your pocket or backpack! Very easy to distribute your application through the AppStore. Vibrant development community. • Real-life Object-Oriented Programming The heart of Cocoa Touch is 100% object-oriented. • Application of MVC design model. • Many computer science concepts applied in a commercial development platform: Databases, Graphics, Multimedia, Multithreading, Animation, Networking, and much, much more!
  • 4. Prerequisites • Prior Coursework Object-Oriented Programming experience mandatory. Structured Programming and Data Structure. • You should know well the meaning of these terms ... Class (description/template for an object) Instance (manifestation of a class) Message (sent to object to make it act) Method (code invoked by a Message) Instance Variable (object-specific storage) Superclass/Subclass (Inheritance) If you are not very comfortable with all of these, this is probably not the class for you! • Programming Experience This is an upper-level CS course. If you have never written a program where you had to design and implement more than a handful of classes, this will be a big step up in difficulty for you.
  • 5. What’s in iOS? CS193p! Winter 2015 Cocoa Touch Media Core Services Core OS Core OS! OSX Kernel! Mach 3.0! BSD! Socket s! Securit y Power Management ! Keychain Access! Cert ificates! File System! Bonj our What ’s in iOS?
  • 16. Welcome to Xcode Search in the Project
  • 17. Welcome to Xcode Breakpoints in the Project for Debugging
  • 19. Welcome to Xcode This is Controller from where we would control our views
  • 20. Welcome to Xcode This is our View where we would design our GUI
  • 21. Welcome to Xcode This is our View where we would design our GUI with Drag and Drop not with code.
  • 22. Welcome to Xcode Double click on white area will Zoom Out the GUI.
  • 23. Welcome to Xcode In complex projects, we will have many of such square areas to design different screens and applications switch from one screen to another screen.This area would be like big map.
  • 24. Welcome to Xcode This is utilities area.
  • 25. Welcome to Xcode This is Object Library. These things make GUI and consist of lot of objects.
  • 26. Let’s make Calculator To make the Result area of Calculator, we need a Label whose text would be updated with the result when we perform addition, subtraction, multiplication and Other mathematical functions. We shall drag and drop that Label on our View area.
  • 27. Let’s make Calculator To make the Result area of Calculator, we need a Label, These Blue lines help me aligning the placement of Label or other GUI elements on the View Area.
  • 28. Let’s make Calculator To make the Result area of Calculator, we need a Label, These boxes show that this Label is selected. You can change the size of Label by clicking and dragging side of the box.
  • 29. Let’s make Calculator To make the Result area of Calculator, we need a Label, These boxes show that this Label is selected. You can change the size of Label by clicking and dragging side of the box.
  • 30. Let’s make Calculator To make the Result area of Calculator, we need a Label, You can change the text Label by double clicking on Label.
  • 31. Let’s make Calculator To make the Result area of Calculator, we need a Label, You have changed the Text Label to 0 by double clicking on Label.
  • 32. Let’s make Calculator To make the Result area of Calculator, we need a Label, Click on Attributes Inspector. Then you can change the text alignment of 0 to Right Align.
  • 33. Let’s make Calculator To make the Result area of Calculator, we need a Label, Click on Attributes Inspector. Then you can change the Font Size of 0 to 32.
  • 34. Let’s make Calculator To make the Result area of Calculator, we need a Label, Click on Lower side of the Label Box to increase the height of the Label.
  • 35. Let’s make Calculator To make the Result area of Calculator, we need a Label, Click on Lower side of the Label Box to increase the height of the Label.
  • 36. Let’s make Calculator Let’s Run this Application. You can Run Application on any iOS device attached to Your computer. Or Run the Application on any Simulator listed below. I don’t have any device currently attached Therefore it would Run in Iphone 6s Plus simulator as shown selected in the image.
  • 37. Let’s make Calculator Let’s Run this Application. You can Run Application by Clicking on Play Button. The application would Run in Iphone 6s Plus Simulator as shown.
  • 38. Let’s make Calculator Now we are in Simulator, its loading now.. This is separate application other than Xcode.
  • 39. Let’s make Calculator Now we are in Simulator, it would ask for Proxy setting if used on UMT Network.
  • 40. Let’s make Calculator Now we are in Simulator, it would not show full screen because my System resolution is lower as compared to Iphone 6s Plus. So we can scale down resolution to 50%.
  • 41. Let’s make Calculator Now we are in Simulator, Now this shows full screen without Scroll on 50% resolution.
  • 42. Let’s make Calculator Now we are in Simulator, This would be the display on Non- Proxy network. But this is just White Screen Why???????????
  • 43. Let’s make Calculator This Label is present there but this is Off screen. See its width. Its Square. No iOS device is Square. They are Rectangle in shape each one has different size and shape. Then why we design in Square???
  • 44. Let’s make Calculator We design everything in Square and then give Rules called Constraints to everything inside square that define what happen to them when they Squished down horizontally or vertically.
  • 45. Let’s make Calculator Now let us give some Rules to this label. That this should know what to do when this Label squished down in any direction for any device.
  • 46. Let’s make Calculator Now let us give some Rules to this label. iOS wants us to use the whole width available so we would pin the right edge of Label Rectangle to the Square right edge. So they will be always pinned to each other.
  • 47. Let’s make Calculator Now let us give some Rules to this label. How we would pin right edges together? Step 1: First Press control button then click and drag from right edge of Label to Square edge as shown in figure.
  • 48. Let’s make Calculator Now let us give some Rules to this label. How we would pin right edges together? Step 2: When you would release the mouse click. It would show the little black box that asks which constraints to choose from the list of constraints
  • 49. Let’s make Calculator Now let us give some Rules to this label. How we would pin right edges together? This would result after step 2 is completed.
  • 50. Let’s make Calculator Now let us give some Rules to this label. How we would pin left edges together? Same 2 step process is repeated here for left edges.
  • 51. Let’s make Calculator Now let us give some Rules to this label. How we would pin top edges together? Same 2 step process is repeated
  • 52. Let’s make Calculator Now let us give some Rules to this label. How we would pin all edges together? This would be result when we pin right, left and top. But we didn’t pin bottom..
  • 53. Let’s make Calculator Now let us give some Rules to this label. How we would pin top edges together? Same 2 step process is repeated
  • 54. Let’s make Calculator You can hide Navigation and Utilities area by pressing these buttons to have this view in xcode.
  • 55. Let’s make Calculator We don’t need this code in our Calculator.
  • 56. Let’s make Calculator This is the Basic Class Declaration code in Swift. This class ViewController is being inhereted from its Superclass UIViewController class. Swift has single inheritance. Means one class can inheret from only one class. Don’t inheret from any class if you don’t want to.
  • 57. Let’s make Calculator We are inheriting from UIViewController so that we can get all the mechanisms of controlling UI through this class in our own ViewController class. We can inheret indirectly from UIViewController as well by inhereting from a class that inherets from UIView Controller.
  • 58. Let’s make Calculator Our own ViewController class has a very generic name when you would make your own application then you would have a lot of these classes and Views so choose a better name like CalculatorViewController that looks more relevant to your application or any better name.
  • 59. Let’s make Calculator To connect this UI with the code. We need to make Instance Variable (Property) so that we can update the value of Label whenever we want by changing the value of that Instance variable. Lets connect UI with ViewController. First we would press Control button and click on Label and drag it into our class code.
  • 60. Let’s make Calculator By releasing it would ask what kind of connection you want to make, We choose Outlet connection. Outlet connection is a instance Variable that points to this Label in UI. Lets name it first.
  • 61. Let’s make Calculator Lets name it first. We have named it display. This would automatically understand that its type is UILabel because we made it by dragging it from Label to our class.
  • 62. Let’s make Calculator This has made an @IBOutlet weak var display: UILabel! Purpose of @IBOutlet is to make a coonection between UILabel and your code as shown in gutter. Weak is for the purpose of Automatic reference counting (ARC) Actual Syntax to create a Property or Instance variable is following var display: UILabel!
  • 63. Let’s make Calculator Now we would put a Button on our View Screen.
  • 64. Let’s make Calculator You can change the size of the button from Size Inspector.
  • 65. Let’s make Calculator We have changed the Button Text to 7 increased its size and Font size of text on the button and would connect this button to UI the same way we did to our Label.
  • 66. Let’s make Calculator Press Control button then click on Button and then drag mouse into the code then this screen would appear.
  • 67. Let’s make Calculator When you would release mouse and Control button. This screen would appear with little box that would ask what would you want to connect. This time we don’t want IBOutlet, we want Action so we would select Action from top drop down menu item.
  • 68. Let’s make Calculator This would Ask for the name of the Action “appendDigit” and change the Type to “UIButton”
  • 69. Let’s make Calculator This would Ask for the name of the Action “appendDigit” and change the Type to “UIButton”. Press Connect button.
  • 70. Let’s make Calculator This is the Syntax of the function definition. func appendDigit(sender: UIButton)
  • 71. Let’s make Calculator If function has return type then its is written after argument paraenthesis after arrow sign. As shown in the figure it is returning the Double. func appendDigit(sender: UIButton, display: UILabel) -> Double.
  • 85. Let’s make Calculator Will Discuss this in Next Class. Thanks