I'm pretty new to iPhone development. I have my "root" view and it is implementing
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
This implementation is working just fine. After a user pushes a button, I do a pushViewController to push a new view onto the stack. If the user shakes the iPhone, the accelerometer fires even though the currently "popped" view is not implementing any accelerometer related methods. It appears to me that the root view is still active even though a different view has been pushed onto the stack. Why is a view that's not the active view still responding to accelerometer?
Thanks
Tom
Actually the root view controller is not inactive in this case. It's just not visible. It is still alive and can receive events.
In your accelerometer delegate, have a flag to check if the root view is visible. Do any operations only if the root view is visible.
if (visible) {
// Do operations
}