January 2012
Beginner
655 pages
16h 35m
English
In this chapter, you have seen the usefulness of the NSTimer class and how it can help you perform some simple animations. You have also learned about the various affine transformations supported by the iOS SDK. Next, you learned how the Image View enables you to animate a series of images at a regular time interval. Last, but not least, you learned how to play back a video in your iPhone application.
EXERCISES
[UIView animateWithDuration:slider.value
delay:0.0f
options:UIViewAnimationOptionAllowUserInteraction ||
UIViewAnimationOptionCurveLinear
animations:^{
//---code to effect visual change---
}
completion:nil];
Answers to the exercises can be found in Appendix D.
WHAT YOU LEARNED IN THIS CHAPTER
| TOPIC | KEY CONCEPTS |
| Using the NSTimer object to create timers | Create a timer object that will call the onTimer method every half-second:
timer = [NSTimer scheduledTimerWithTimelnterval: 0.5
target:self
selector:@selector(onTimer)
userInfo:nil
repeats:YES];
|
| Stopping the NSTimer object |
[timer invalidate]; ... |