IOS Development
Lec 2
Anatomy of an
         Application
Compiled code
   Your code
   Frameworks

Nib files
   UI elements and other objects
   Details about object relationships

Resources (images, sounds, strings, etc)

Info.plist file (application configuration)
App Lifecycle
UIKit Framework
Starts your application
Every application has a single instance of UIApplication
   Singleton design pattern
@interface UIApplication + (UIApplication *)sharedApplication
@end
   Orchestrates the lifecycle of an application
   Dispatches events
   Manages status bar, application icon badge
   Rarely subclassed
      Uses delegation instead
Delegation
Control passed to delegate objects to perform
application- specific behavior

Avoids need to subclass complex objects

Many UIKit classes use delegates
   UIApplication
   UITableView
   UITextField
UIApplicationDelegate
Xcode project templates have one set up by
default

Object you provide that participates in application
lifecycle

Can implement various methods which
UIApplication will call
UIApplicationDelegate
   Examples:

-(void)applicationDidFinishLaunching:(UIApplication
*)application;

- (void)applicationWillTerminate:(UIApplication *)application;

- (void)applicationWillResignActive:(UIApplication *)application;

-(BOOL)application:(UIApplication *)application
handleOpenURL:(NSURL *)url;

- (void)applicationDidReceiveMemoryWarning:(UIApplication
*)application;
Info.plist file
Property List (often XML), describing your application
   Icon appearance
   Status bar style (default, black, hidden)
   Orientation
   Uses Wifi networking
   System Requirements

Can edit most properties in Xcode
Project > Edit Active Target “Foo” menu item
On the properties tab
MVC
Model, View, Controller

             controller




     model                view
Model
Manages the app data and state

Not concerned with UI or presentation

Often persists somewhere

Same model should be reusable, unchanged in
different interfaces
View
Present the Model to the user in an appropriate
interface

Allows user to manipulate data

Does not store any data
   (except to cache state)

Easily reusable & configurable to display different
data
Controller
Intermediary between Model & View

Updates the view when the model changes

Updates the model when the user manipulates
the view

Typically where the app logic lives.
Ios development 2
Demo
Interface Builder and
         Nibs
Nib Files - Design time
Helps you design the „V‟ in MVC:
   layout user interface elements
   add controller objects
   Connect the controller and UI
Nib Loading
At runtime, objects are unarchived
    Values/settings in Interface Builder are restored
    Ensures all outlets and actions are connected
    Order of unarchiving is not defined

If loading the nib automatically creates objects and order is
undefined, how do I customize?
    For example, to displaying initial state

    -awakeFromNib
Control point to implement any additional logic after nib
loading
Default empty implementation on NSObject

You often implement it in your controller class
   e.g. to restore previously saved application state

Guaranteed everything has been unarchived
from nib, and all connections are made before -
awakeFromNib is called
Controls – Events
View objects that allows users to initiate some type of
action

Respond to variety of events
   Touch events
      touchDown
      touchDragged (entered, exited, drag inside, drag
      outside)
      touchUp (inside, outside)
   Value changed
   Editing events
      editing began
      editing changed
      editing ended
Demo
Target/Action - event
Action Methods
3 different flavors of action method selector types




        nMethod:(id)sender withEvent:(UIEvent *)event;

UIEvent contains details about the event that took place
Action Method Variations
     Simple no-argument selector




     Single argument selector - control is „sender‟
//
Action Method Variations
 Two-arguments in selector (sender & event)
Multiple target-actions
Controls can trigger multiple actions on different
targets in response to the same event

Different than Cocoa on the desktop where only
one target- action is supported

Different events can be setup in IB
Manual Target-Action
Same information IB would use
API and UIControlEvents found in UIControl.h
UIControlEvents is a bitmask

More Related Content

PPTX
iOS Development (Part 2)
PDF
Refreshing Your App in iOS 7
PPTX
Event and signal driven programming techniques
PDF
Angular Rebooted: Components Everywhere
PDF
Automated Testing on iOS
PDF
Intro to iOS Application Architecture
PDF
Next generation of frontend architectures - Luca Mezzalira - Codemotion Milan...
PDF
iOS Layout Overview
iOS Development (Part 2)
Refreshing Your App in iOS 7
Event and signal driven programming techniques
Angular Rebooted: Components Everywhere
Automated Testing on iOS
Intro to iOS Application Architecture
Next generation of frontend architectures - Luca Mezzalira - Codemotion Milan...
iOS Layout Overview

What's hot (12)

PPTX
Dependency Inversion in large-scale TypeScript applications with InversifyJS
PPTX
Dive into Angular, part 2: Architecture
PPTX
Cycle.js a reactive framework
KEY
iPhone Development Tools
PDF
Xcode 7 UI Testing - Xcake Dublin, October 2015
PPTX
Dive into Angular, part 5: Experience
PDF
Automated Xcode 7 UI Testing
PPTX
Dive into Angular, part 3: Performance
PPT
Introduction to the INTEGRAL FRAMEWORK
PPT
Introduction to the integral framework
PPTX
Basic Intro to android(Will be updating later)
PDF
JavaScript framework overview
Dependency Inversion in large-scale TypeScript applications with InversifyJS
Dive into Angular, part 2: Architecture
Cycle.js a reactive framework
iPhone Development Tools
Xcode 7 UI Testing - Xcake Dublin, October 2015
Dive into Angular, part 5: Experience
Automated Xcode 7 UI Testing
Dive into Angular, part 3: Performance
Introduction to the INTEGRAL FRAMEWORK
Introduction to the integral framework
Basic Intro to android(Will be updating later)
JavaScript framework overview
Ad

Similar to Ios development 2 (20)

PDF
Introduction of Xcode
PPTX
iOS for C# Developers - DevConnections Talk
PPTX
iOS Development (Part 1)
PDF
Session 7 - Overview of the iOS7 app development architecture
PDF
02 objective-c session 2
PPTX
Code camp 2011 Getting Started with IOS, Una Daly
PPTX
iOS app dev Training - Session1
PDF
I pad uicatalog_lesson02
PPT
ios basics
PPTX
iOS Coding Best Practices
PPT
Ios development
PDF
Task 2 - Educational Article – Model View Controller (MVC)
PPTX
iOS Beginners Lesson 2
PDF
iOS (7) Workshop
PDF
04 Model View Controller
PDF
iPhone dev intro
PDF
Beginning to iPhone development
PDF
Assignment2 B Walkthrough
PPT
Ios - Intorduction to view controller
PDF
iPhone SDK dev sharing - the very basics
Introduction of Xcode
iOS for C# Developers - DevConnections Talk
iOS Development (Part 1)
Session 7 - Overview of the iOS7 app development architecture
02 objective-c session 2
Code camp 2011 Getting Started with IOS, Una Daly
iOS app dev Training - Session1
I pad uicatalog_lesson02
ios basics
iOS Coding Best Practices
Ios development
Task 2 - Educational Article – Model View Controller (MVC)
iOS Beginners Lesson 2
iOS (7) Workshop
04 Model View Controller
iPhone dev intro
Beginning to iPhone development
Assignment2 B Walkthrough
Ios - Intorduction to view controller
iPhone SDK dev sharing - the very basics
Ad

Recently uploaded (20)

PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
Architecture types and enterprise applications.pdf
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PPTX
Benefits of Physical activity for teenagers.pptx
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
August Patch Tuesday
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
DOCX
search engine optimization ppt fir known well about this
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Unlock new opportunities with location data.pdf
PDF
Five Habits of High-Impact Board Members
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PPT
Geologic Time for studying geology for geologist
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
observCloud-Native Containerability and monitoring.pptx
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
Architecture types and enterprise applications.pdf
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Assigned Numbers - 2025 - Bluetooth® Document
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Benefits of Physical activity for teenagers.pptx
Chapter 5: Probability Theory and Statistics
Hindi spoken digit analysis for native and non-native speakers
August Patch Tuesday
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
search engine optimization ppt fir known well about this
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Unlock new opportunities with location data.pdf
Five Habits of High-Impact Board Members
O2C Customer Invoices to Receipt V15A.pptx
Geologic Time for studying geology for geologist
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
NewMind AI Weekly Chronicles – August ’25 Week III
Group 1 Presentation -Planning and Decision Making .pptx

Ios development 2

  • 2. Anatomy of an Application Compiled code Your code Frameworks Nib files UI elements and other objects Details about object relationships Resources (images, sounds, strings, etc) Info.plist file (application configuration)
  • 4. UIKit Framework Starts your application Every application has a single instance of UIApplication Singleton design pattern @interface UIApplication + (UIApplication *)sharedApplication @end Orchestrates the lifecycle of an application Dispatches events Manages status bar, application icon badge Rarely subclassed Uses delegation instead
  • 5. Delegation Control passed to delegate objects to perform application- specific behavior Avoids need to subclass complex objects Many UIKit classes use delegates UIApplication UITableView UITextField
  • 6. UIApplicationDelegate Xcode project templates have one set up by default Object you provide that participates in application lifecycle Can implement various methods which UIApplication will call
  • 7. UIApplicationDelegate Examples: -(void)applicationDidFinishLaunching:(UIApplication *)application; - (void)applicationWillTerminate:(UIApplication *)application; - (void)applicationWillResignActive:(UIApplication *)application; -(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url; - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application;
  • 8. Info.plist file Property List (often XML), describing your application Icon appearance Status bar style (default, black, hidden) Orientation Uses Wifi networking System Requirements Can edit most properties in Xcode Project > Edit Active Target “Foo” menu item On the properties tab
  • 9. MVC
  • 10. Model, View, Controller controller model view
  • 11. Model Manages the app data and state Not concerned with UI or presentation Often persists somewhere Same model should be reusable, unchanged in different interfaces
  • 12. View Present the Model to the user in an appropriate interface Allows user to manipulate data Does not store any data (except to cache state) Easily reusable & configurable to display different data
  • 13. Controller Intermediary between Model & View Updates the view when the model changes Updates the model when the user manipulates the view Typically where the app logic lives.
  • 15. Demo
  • 17. Nib Files - Design time Helps you design the „V‟ in MVC: layout user interface elements add controller objects Connect the controller and UI
  • 18. Nib Loading At runtime, objects are unarchived Values/settings in Interface Builder are restored Ensures all outlets and actions are connected Order of unarchiving is not defined If loading the nib automatically creates objects and order is undefined, how do I customize? For example, to displaying initial state -awakeFromNib Control point to implement any additional logic after nib loading
  • 19. Default empty implementation on NSObject You often implement it in your controller class e.g. to restore previously saved application state Guaranteed everything has been unarchived from nib, and all connections are made before - awakeFromNib is called
  • 20. Controls – Events View objects that allows users to initiate some type of action Respond to variety of events Touch events touchDown touchDragged (entered, exited, drag inside, drag outside) touchUp (inside, outside) Value changed Editing events editing began editing changed editing ended
  • 22. Action Methods 3 different flavors of action method selector types nMethod:(id)sender withEvent:(UIEvent *)event; UIEvent contains details about the event that took place
  • 23. Action Method Variations Simple no-argument selector Single argument selector - control is „sender‟ //
  • 24. Action Method Variations Two-arguments in selector (sender & event)
  • 25. Multiple target-actions Controls can trigger multiple actions on different targets in response to the same event Different than Cocoa on the desktop where only one target- action is supported Different events can be setup in IB
  • 26. Manual Target-Action Same information IB would use API and UIControlEvents found in UIControl.h UIControlEvents is a bitmask

Editor's Notes

  • #22: UIControlEventTouchUpInside-(void)decrease