【发布时间】:2010-11-01 13:29:06
【问题描述】:
我有 view1,当摇动时将加载 view2,并且在 view2 中按下按钮加载 view3,在 view3 中按下按钮加载 view1。当从 view3 加载 view1 时,view1 中的摇动手势不再响应摇动。
- (BOOL)canBecomeFirstResponder {
return YES; // making view the first responder for shake event
}
- (void)viewDidAppear:(BOOL)animated {
[self becomeFirstResponder]; //for the shake event
[super viewDidAppear:animated];
}
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if (motion==UIEventSubtypeMotionShake) {
//adding AskAsh2VC START
AskAsh2VC *second = [[AskAsh2VC alloc] initWithNibName:nil bundle:nil];
//this will set the animation style to CROSSDISSOLVE!
second.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:second animated:YES];
[second release];
//adding AskAsh2VC END
}
}
- (IBAction)goToAskAsh2VC: (id) sender {
// NSLog(@"Button WORKS!!!!");
//adding AskAsh2VC START
AskAsh2VC *second = [[AskAsh2VC alloc] initWithNibName:nil bundle:nil];
//this will set the animation style to CROSSDISSOLVE!
second.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:second animated:YES];
[second release];
}
【问题讨论】:
标签: objective-c ipad ios4