我用沙克姿态申请我,但我有问题!
My application is a multiview application and i want use shake gesture on the view 2. If i active shake gesture on view 2, I have to write the code below in the MainViewController.m and MyView2Controller.m to use the shake gesture.
接着,如果我打听电话,就会对这两种观点进行警示,而我则想这样做。 我只想看到第2点。 因此,如果对《第一号主要意见》的守则不采取行动,它就不再发挥作用了。
任何帮助都值得赞赏。
alt text http://www.freezpic.com/pics/98f1465147344642e3870bb599eba689.jpg
我的法典如下:
-(BOOL)canBecomeFirstResponder {
return YES;
}
-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self becomeFirstResponder];
}
-(void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if (event.subtype == UIEventSubtypeMotionShake)
{
UIAlertView *alet =[[UIAlertView alloc]initWithTitle:nil message:@"Shake shake shake" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alet show];
[alet release];
self.view.backgroundColor = [UIColor orangeColor];
}
}