In order to receive UIDeviceOrientation change notifications, one must do two things:
- call
beginGeneratingDeviceOrientationNotificationsonUIDevice - register for the notifications.
Here’s my question:
Let’s say I have two view controllers who want to receive these notifications and the first calls beginGeneratingDeviceOrientationNotifications and registers, then the second does the same. Now my first VC unloads and unregisters and calls endGeneratingDeviceOrientationNotifications. Will the second VC continue to receive these notifications even though the first VC “turned them off”?
Yes. The documentation for the
begin…method says so, at least sort-of:This kind of interface is usually implemented using some counter. Each
begin…method increments the counter, eachend…method decrements it. The notifications are sent as long as the counter is greater than zero.