User Tools

Site Tools


ios-labs-s14:class-07

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ios-labs-s14:class-07 [2014/02/24 13:41]
mbarboi created
ios-labs-s14:class-07 [2014/02/24 13:44] (current)
mbarboi
Line 1: Line 1:
- +======DriveSense Intro====== 
-=====DriveSense Intro===== +Welcome to the last week of the iOS tutorials. Here we will be tackling some of the more intermediate and advanced topics in iOS development. If you're going to be writing iOS apps, you've already learned more than enough to get started. Everything we cover from here on out deals with specific frameworks, functionality,​ or features such as GPS, social sharing, and the local database-- you can get by just fine without learning any of this material, but learning it now will help you greatly if you are later confronted with it. Obviously the repetition inherent in iOS development will continue to teach you the basics, too.
-Welcome to the last week of the iOS tutorials. Here we will be tackling some of the more intermediate and advanced topics in iOS development. If you're going to be writing iOS apps, you've already learned more than enough to get started. Everything we cover from here on out deals with specific frameworks, functionality,​ or features such as GPS, social sharing, and the local database-- you can get by just fine without learning any of this material, but learning it now will help you greatly if you are later confronted with it. +
  
 DriveSense is an app produced by the CS department. Its purpose is to track and grade drivers'​ performance through a grading system that considers GPS, accelerator,​ and compass data. Abrupt turns, braking, or speeding will decrease the driver'​s score, while consistent good driving will return a high score. Trips are logged automatically when power is turned in and the app detects acceleration only possible in a vehicle or manually. Users can view all trips and scores on the device or online through a web interface. DriveSense is an app produced by the CS department. Its purpose is to track and grade drivers'​ performance through a grading system that considers GPS, accelerator,​ and compass data. Abrupt turns, braking, or speeding will decrease the driver'​s score, while consistent good driving will return a high score. Trips are logged automatically when power is turned in and the app detects acceleration only possible in a vehicle or manually. Users can view all trips and scores on the device or online through a web interface.
Line 117: Line 116:
 TripRecorder will have two public methods, startRecording and stopRecording. It will rely on the other location framework to stay updated as to the user's location, **CoreLocation.** TripRecorder will have two public methods, startRecording and stopRecording. It will rely on the other location framework to stay updated as to the user's location, **CoreLocation.**
  
-=====Setting up CoreLocation=====+====Setting up CoreLocation====
   -Link project against CoreLocation framework, import framework headers into TripRecorder.h   -Link project against CoreLocation framework, import framework headers into TripRecorder.h
   -Create private instance variable of type CLLocationManager,​ initialize it in TripRecorder'​s init method   -Create private instance variable of type CLLocationManager,​ initialize it in TripRecorder'​s init method
Line 124: Line 123:
 Location updates come in through a delegate method called //​locationManager:​didUpdateLocation//​. This method is called whenever an update comes through, but you must alert the locationManager you want to be alerted of updates first. Location updates come in through a delegate method called //​locationManager:​didUpdateLocation//​. This method is called whenever an update comes through, but you must alert the locationManager you want to be alerted of updates first.
  
-=====Recording Location=====+====Recording Location====
   -Add two public methods to TripRecorder (header and implementation files) called "​startRecording"​ and "​stopRecording"​   -Add two public methods to TripRecorder (header and implementation files) called "​startRecording"​ and "​stopRecording"​
   -Call "​startUpdatingLocation"​ and "​stopUpdatingLocation"​ on your CLLocationManager instance variable in the appropriate method implementations   -Call "​startUpdatingLocation"​ and "​stopUpdatingLocation"​ on your CLLocationManager instance variable in the appropriate method implementations
Line 139: Line 138:
 The last step here is to turn on and off the recorder from the MapRoot controller. You'll call the singleton accessor method first, then call "​stopRecording"​ and "​startRecording"​ on the resulting object. The last step here is to turn on and off the recorder from the MapRoot controller. You'll call the singleton accessor method first, then call "​stopRecording"​ and "​startRecording"​ on the resulting object.
  
-=====Recording and Pausing=====+====Recording and Pausing====
   -Import TripRecorder into MapRoot   -Import TripRecorder into MapRoot
   -Use following code to call methods on singleton:   -Use following code to call methods on singleton:
Line 153: Line 152:
 Here we will look at the last part needed to make dynamic, fluid interfaces. The actual code is easy, the tough part is conceptualizing what needs to be done as far as coordinates,​ frames, and views. ​ Here we will look at the last part needed to make dynamic, fluid interfaces. The actual code is easy, the tough part is conceptualizing what needs to be done as far as coordinates,​ frames, and views. ​
  
-=====Adding Slide-In Pane=====+====Adding Slide-In Pane====
   -Add a new view to the bottom of the controller. Make it the same height as the top bar view   -Add a new view to the bottom of the controller. Make it the same height as the top bar view
   -Add a few dummy labels   -Add a few dummy labels
Line 170: Line 169:
 Since the view begins in its final resting position but must immediately leave the screen on controller launches, we need to save the starting frame to animate it onscreen. To animate it offscreen, you'll set the y-origin to the height of the screen. Since the view begins in its final resting position but must immediately leave the screen on controller launches, we need to save the starting frame to animate it onscreen. To animate it offscreen, you'll set the y-origin to the height of the screen.
  
-=====Animating=====+====Animating====
   -Create instance variable of type CGRect   -Create instance variable of type CGRect
   -In viewDidAppear,​ set the instance variable equal to YOURVIEW.frame   -In viewDidAppear,​ set the instance variable equal to YOURVIEW.frame
Line 178: Line 177:
   -Call animate out in viewDidAppear,​ call both methods in appropriate parts of the play buttons'​ IBAction   -Call animate out in viewDidAppear,​ call both methods in appropriate parts of the play buttons'​ IBAction
  
-====Extra Extra Credit====+===Extra Extra Credit===
 Bored? Finished early? Figure out how to update the label in the slide-in view to show a time counter. Youll need the following: Bored? Finished early? Figure out how to update the label in the slide-in view to show a time counter. Youll need the following:
   -NSTimer'​s scheduledTimerWithInterval method   -NSTimer'​s scheduledTimerWithInterval method
ios-labs-s14/class-07.1393270903.txt.gz · Last modified: 2014/02/24 13:41 by mbarboi