Remote Control of Your Sound
Various sorts of signal constitute remote control. There is hardware remote control; the user might be using earbuds with buttons, for example. There is also software remote control; for example, in iOS 4, the playback controls that you see when you double-click the Home button to view the fast app switcher and then swipe to the right (Figure 27-1) are a form of software remote control. Similarly, the buttons that appear if you double-click the Home button when the screen is locked and sound is playing are a form of software remote control (Figure 27-2).
Figure 27-1. The software remote controls in the iOS 4 app switcher
Figure 27-2. The software remote controls on the locked screen
Your app can arrange to be targeted by remote control events reporting that the user has tapped a remote control. This is particularly appropriate in an app that plays sound. Your sound-playing app can respond to the remote play/pause button, for example, by playing or pausing its sound.
Remote control events are a form of UIEvent, and they are sent initially to the first responder. (See Chapter 11 and Chapter 18 on UIResponders and the responder chain.) To arrange to be a recipient of remote control events:
- Your app must contain a UIResponder in its responder chain that returns ...
Get Programming iOS 4 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.