Day 2
Recap
Story Boards
Storyboards are the user interface elements of an App
n modern versions of Xcode this is integrated in the program.
Story Boards Explained
edit the file / element your working on. The Bottom allows you to choose
Choose the View Controller
Class that is associated
with this view (MVC)
Choose objects to add to a view such as
UITextField, UIButton or objects such
as a new View.
Delegation
behalf of, or in coordination with, another object when that obje
must fulfil some obligations (delegate methods) usually decla
Examples:
AppDelegate
UITableViewDelegate
Table Views
One of the most commonly used elements is UITable View
Two of Types of UI Table View
Plain Grouped
Table Views
A Table View consists of many parts all of which are
able to be customised.
Table View
Section
Section Header
with Label
Table View Cell
with Label
Table Views
Apple has created a controller for a UITableView
Called UITableViewController and if you subclass it
in your View Controller then it will set this stuff up for you.
Header file (.h)
Subclass UITableViewController
Declare the Delegate and Datasource Protocols
Implementation file (.m)
UITableView
Delegate Methods
Demo
(TableView)
View Controller Lifecycle
viewDidLoad
viewWillAppear
viewDidAppear
viewWillDisappear
viewDidDisappear
viewDidUnload
Demo
(Image View, Web View, Collection View)
Navigation Controller
The Navigation Controller is a very common way to display multiple views
and works with a stack
Navigation Controller
By using the navigation controller iOS creates a container and then
automatically creates the bar at the top with the back button allowing users
to easily navigate. There is also a lot of performance enhancements behind
the scenes too.
To create a navigation stack you can easily do that in the storyboard.
Demo Linking Nav Controller
Persistence
In iOS there are a range of ways to persist data on and off the device.
On Device
• NSUserDefaults (max 300kb) - This is for small amounts of data, usually used for
saving settings / User data in apps
• Plist / Disk - This is for slightly larger data and doesn't really have a limit but can be
low on performance. Mainly used for media on disk.
• Core Data - This is the most common way for storing data and is the iOS internal DB.
It runs on a NO-SQL basis.
• SQL Lite - This is another option for a DB and uses SQL.
Off Device
• Web Service - Third party API’s allow you to easily store data off device and usually
charge based on concurrent requests to the server. Some examples are below.
1. AWS
2. Parse
3. Other 3rd Party
Persistence
File System: Property Lists
- NSArray and NSDictionary can do this
- Can only save supported “plist” types - - NSString
- - NSNumber
- - NSDate
- - NSData
Persistence
File System: Saving Images
- Get resources from the main app bundle (images,
databases, mp4)
Blocks and Multi Threading
One of the main ways in which computers since the 90’s have dealt with
multiple processes is Multi Threading
Multi Threading means that you can run multiple concurrent processes
separately on whats called threads.
Number 1 rule is that all UI should be called on the main thread.
Why use Threads? One use is so that if were pulling data over the network
then we don’t block the UI of the app. If we do it will give a bad experience
and make our user think the app has crashed.
Blocks and Multi Threading
To use threads on iOS we use something called Blocks. Blocks are very
common is iOS since the release of iOS 5.
Blocks
Further info on blocks - http://www.raywenderlich.com/9438/how-to-use-blocks-in-ios-5-tutorial-part-2
What is a block?
- a block of code (i.e a sequence of statements inside {}).
Usually included “in-line” with the calling of a method that is going to
use that block of code.
Example of Block
Blocks and Multi Threading
To dispatch a task to a different Thread we use a C API called ‘Grand
Central Dispatch’ (GCD).
Animations
can easily animate any UI View using core animation. An example of this is b
Categories
Categories allow us to add extra methods to existing classes even if we didn't write them.
Header (.h)
Categories
Interface (.m)
Frameworks and Coca Pods
Frameworks in iOS are collections of code that allow apps to
Examples of Apple Frameworks:
Mapkit
Core Audio
Core Animation
Examples of 3rd Party Frameworks:
Stripe
Facebook
Parse
Twitter
Testing Your App
e simulator then simply build and run and in Xcode and it will la
d to be enrolled in the Apple Developer Program and then gen
Instruments and Other Apps
applications that can be used to find where issues lie in your a
• String with format
• App Coda
• Ray Weinerlich

iOS Course day 2

  • 1.
  • 2.
  • 3.
    Story Boards Storyboards arethe user interface elements of an App n modern versions of Xcode this is integrated in the program.
  • 4.
    Story Boards Explained editthe file / element your working on. The Bottom allows you to choose Choose the View Controller Class that is associated with this view (MVC) Choose objects to add to a view such as UITextField, UIButton or objects such as a new View.
  • 5.
    Delegation behalf of, orin coordination with, another object when that obje must fulfil some obligations (delegate methods) usually decla Examples: AppDelegate UITableViewDelegate
  • 6.
    Table Views One ofthe most commonly used elements is UITable View Two of Types of UI Table View Plain Grouped
  • 7.
    Table Views A TableView consists of many parts all of which are able to be customised. Table View Section Section Header with Label Table View Cell with Label
  • 8.
    Table Views Apple hascreated a controller for a UITableView Called UITableViewController and if you subclass it in your View Controller then it will set this stuff up for you. Header file (.h) Subclass UITableViewController Declare the Delegate and Datasource Protocols Implementation file (.m) UITableView Delegate Methods
  • 9.
  • 10.
  • 11.
    Demo (Image View, WebView, Collection View)
  • 12.
    Navigation Controller The NavigationController is a very common way to display multiple views and works with a stack
  • 13.
    Navigation Controller By usingthe navigation controller iOS creates a container and then automatically creates the bar at the top with the back button allowing users to easily navigate. There is also a lot of performance enhancements behind the scenes too. To create a navigation stack you can easily do that in the storyboard. Demo Linking Nav Controller
  • 14.
    Persistence In iOS thereare a range of ways to persist data on and off the device. On Device • NSUserDefaults (max 300kb) - This is for small amounts of data, usually used for saving settings / User data in apps • Plist / Disk - This is for slightly larger data and doesn't really have a limit but can be low on performance. Mainly used for media on disk. • Core Data - This is the most common way for storing data and is the iOS internal DB. It runs on a NO-SQL basis. • SQL Lite - This is another option for a DB and uses SQL. Off Device • Web Service - Third party API’s allow you to easily store data off device and usually charge based on concurrent requests to the server. Some examples are below. 1. AWS 2. Parse 3. Other 3rd Party
  • 15.
    Persistence File System: PropertyLists - NSArray and NSDictionary can do this - Can only save supported “plist” types - - NSString - - NSNumber - - NSDate - - NSData
  • 16.
    Persistence File System: SavingImages - Get resources from the main app bundle (images, databases, mp4)
  • 17.
    Blocks and MultiThreading One of the main ways in which computers since the 90’s have dealt with multiple processes is Multi Threading Multi Threading means that you can run multiple concurrent processes separately on whats called threads. Number 1 rule is that all UI should be called on the main thread. Why use Threads? One use is so that if were pulling data over the network then we don’t block the UI of the app. If we do it will give a bad experience and make our user think the app has crashed.
  • 18.
    Blocks and MultiThreading To use threads on iOS we use something called Blocks. Blocks are very common is iOS since the release of iOS 5. Blocks Further info on blocks - http://www.raywenderlich.com/9438/how-to-use-blocks-in-ios-5-tutorial-part-2 What is a block? - a block of code (i.e a sequence of statements inside {}). Usually included “in-line” with the calling of a method that is going to use that block of code. Example of Block
  • 19.
    Blocks and MultiThreading To dispatch a task to a different Thread we use a C API called ‘Grand Central Dispatch’ (GCD).
  • 20.
    Animations can easily animateany UI View using core animation. An example of this is b
  • 21.
    Categories Categories allow usto add extra methods to existing classes even if we didn't write them. Header (.h)
  • 22.
  • 23.
    Frameworks and CocaPods Frameworks in iOS are collections of code that allow apps to Examples of Apple Frameworks: Mapkit Core Audio Core Animation Examples of 3rd Party Frameworks: Stripe Facebook Parse Twitter
  • 24.
    Testing Your App esimulator then simply build and run and in Xcode and it will la d to be enrolled in the Apple Developer Program and then gen
  • 25.
    Instruments and OtherApps applications that can be used to find where issues lie in your a
  • 26.
    • String withformat • App Coda • Ray Weinerlich