Book Image

Application Development in iOS 7

By : Kyle Begeman
Book Image

Application Development in iOS 7

By: Kyle Begeman

Overview of this book

Table of Contents (15 chapters)
Application Development in iOS 7
About the Author
About the Reviewers


iOS 7 introduces a completely new class to the Foundation framework, NSProgress. Using NSProgress involves treating each task of an action as a milestone of completion. By doing so, you, the developer, can track progress directly in code and perform individual tasks for each milestone.

For instance, to perform a particular action, you may require four separate tasks to be completed. Each task is capable of monitoring its own progress, and will report once the task is complete. In our example, this would increase the percent of completion to 25.

NSProgress uses Key Value Observing (KVO) to provide notifications related to progress. These notifications can be used to update a UI component displaying progress to the user, such as a progress bar or label. The following code is a very simple implementation that demonstrates working with NSProgress to report progress in a localized manner:

NSArray *data = @[@"Data 1", @"Data 2", @"Data 3", @"Data 4"];

  self.dataProgress = [NSProgress...