views:

96

answers:

2

I think I've done all I should to detect a shake, but motionEnded:withEvent: never gets called. (One wrinkle is that I don't have a UIViewController - my app is based on the "OpenGL ES App" template.)

I've added application.applicationSupportsShakeToEdit = YES; to my application:didFinishLaunchingWithOptions:, and

- (BOOL)canBecomeFirstResponder { return YES; }

to EAGLView.m (which does get called), and [self becomeFirstResponder]; to initWithCoder: (and have tried various other places too).

But the debugger never hits

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event 

Am I missing some step? Do I have to have a controller?

(I'm using iOS 3.2 in the iPad simulator.)

A: 

You can't become the first responder before your view is in the view hierarchy.

tc.
I tried calling it other places too but it didn't seem to help - like in `drawView`.
Grumdrig
Can you create a view controller to stick the EAGLView in, and call becomeFirstResponder in viewDidAppear:?
tc.
I was sorta trying to avoid that if I can. `UIView`s are `UIResponder`s, if I'm not mistaken.
Grumdrig
A: 

Updating to the latest version of the SDK magically fixed the problem. [Shrug]

Grumdrig