Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

iOS Course day 2

217 views

Published on

Day 2 of iOS Course. Once again excuse any typos.

Published in: Engineering
  • Be the first to comment

iOS Course day 2

  1. 1. Day 2
  2. 2. Recap
  3. 3. Story Boards Storyboards are the user interface elements of an App n modern versions of Xcode this is integrated in the program.
  4. 4. 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.
  5. 5. Delegation behalf of, or in coordination with, another object when that obje must fulfil some obligations (delegate methods) usually decla Examples: AppDelegate UITableViewDelegate
  6. 6. Table Views One of the most commonly used elements is UITable View Two of Types of UI Table View Plain Grouped
  7. 7. 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
  8. 8. 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
  9. 9. Demo (TableView)
  10. 10. View Controller Lifecycle viewDidLoad viewWillAppear viewDidAppear viewWillDisappear viewDidDisappear viewDidUnload
  11. 11. Demo (Image View, Web View, Collection View)
  12. 12. Navigation Controller The Navigation Controller is a very common way to display multiple views and works with a stack
  13. 13. 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
  14. 14. 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
  15. 15. Persistence File System: Property Lists - NSArray and NSDictionary can do this - Can only save supported “plist” types - - NSString - - NSNumber - - NSDate - - NSData
  16. 16. Persistence File System: Saving Images - Get resources from the main app bundle (images, databases, mp4)
  17. 17. 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.
  18. 18. 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
  19. 19. Blocks and Multi Threading To dispatch a task to a different Thread we use a C API called ‘Grand Central Dispatch’ (GCD).
  20. 20. Animations can easily animate any UI View using core animation. An example of this is b
  21. 21. Categories Categories allow us to add extra methods to existing classes even if we didn't write them. Header (.h)
  22. 22. Categories Interface (.m)
  23. 23. 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
  24. 24. 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
  25. 25. Instruments and Other Apps applications that can be used to find where issues lie in your a
  26. 26. • String with format • App Coda • Ray Weinerlich

×