Join Steven Lipton for an in-depth discussion in this video Add elapsed tIme, part of Advanced iOS App Development: Core Motion.
- [ Voiceover] The Pedometer application so far,…cannot measure pace for all devices.…We tried using the built in average pace,…to the CM Pedometer class,…but that didn't work for the iPhone 5s I'm using.…Pace, however, is a calculated value,…and it's a good example of getting around…the lack of device availability.…I've got distance on this device,…and all I need is time to compute pace on my own.…Let's add elapsed time to the app,…from that I'll compute an average pace.…An easy way to get elapsed time,…is to add a counter to the current timer,…and display the counter.…
At the top of the code,…add the following two declarations:…var…elapsed seconds…equals 0.0…and let interval…equals 0.1…I'll use elapsed seconds as a counter,…and interval as an increment.…I'll change my timer to use this interval.…Slide down to start timer.…
Change the time interval from 1.0 to interval.…In the completion block, add an increment…to elapsed seconds.…Self.elapsed seconds…plus, equals…self.interval.…With an elapsed time property,…I'll display it on the application in the status label.…
- Reading Core Motion data
- Understanding Core Motion methods
- Creating a pedometer app
- Using pace and distance data from Core Motion
- Pushing and pulling device motion data
- Accessing the altitude sensors
- Working with the motion activity manager (CMMotionActivityManager)
Skill Level Advanced
iOS App Development: Accessibilitywith Kevin Favro2h 34m Intermediate
Advanced iOS Development: Working with APIswith Saul Mora1h 59m Intermediate
1. Core Motion Introduction
3. Device Motion
5. Recorded Data
Next steps1m 43s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.