I put the motionBegan:withEvent: method in my view controller to see if it would work, but it's not being called. In viewWillAppear
, I made the view controller the first responder, and return YES from canBecomeFirstResponder
.
This view controller is in the master pane of a split view, so maybe the first responder was changed before I shook the device.
But my real question is how can I have all motion events passed to a handler in my app delegate? Do I really have to have motionBegan:withEvent: methods in all view controllers or delegates to all first responders? Isn't there a way to events like this to flow up the responder chain without inserting code into each UIResponder? It seems that there would be, but I haven't put my finger on how to do this.
the easiest way is override -sendEvent:
in UIApplication
then you will have controll over all events
that you may use this class
int retVal = UIApplicationMain(argc, argv, @"myApplication", @"myAppDelegate");
another solution is make category or expand -viewWillAppear:
more info