Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Application Development in iOS 7
  • Table Of Contents Toc
Application Development in iOS 7

Application Development in iOS 7

By : Kyle Begeman
4.7 (3)
close
close
Application Development in iOS 7

Application Development in iOS 7

4.7 (3)
By: Kyle Begeman

Overview of this book

Table of Contents (15 chapters)
close
close
Application Development in iOS 7
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1
Index

NSTimer


It is a common practice to perform periodic tasks using NSTimer. The following is an example use of NSTimer to perform a task in two-second intervals and repeats:

[NSTimer scheduledTimerWithTimeInterval:2.0
  target:self
  selector:@selector(targetMethod:)
  userInfo:nil
  repeats:YES];

The issue with this method is that the CPU is consistently active in order to perform the desired task repeatedly. When using multiple timers at once, it is possible (although unlikely) that it may reduce the performance of the CPU for the rest of your application. It is always best practice to run tests on your applications to find such possibilities and use safeguards wherever possible.

Apple has added a new tolerance property to NSTimer to reduce the strain on the CPU when using NSTimers. This property will tell the application how late a timer is allowed to fire when it has surpassed its scheduled interval. As a result, the application will be able to group actions together to reduce CPU strain.

This...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Application Development in iOS 7
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon