84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
项目中用到了MMDrawerController这个侧滑框架,今天在做一个摇一摇的功能.项目框架图请看:
蓝色框的代码是实现摇一摇功能,在没有使用MMDrawerController的情况下亲测是成功的。但在使用MMDrawerController后,检测不到摇一摇,实现不了,各位看官有遇到过吗?在线等
业精于勤,荒于嬉;行成于思,毁于随。
This issue has been resolved. It’s not a problem with this third-party framework. Here’s the complete solution code:Implemented in Appdelegate
//Support shaking[[UIApplication sharedApplication] setApplicationSupportsShakeToEdit:YES];
Implement the following code in the controller that needs to be shaken:
(BOOL)canBecomeFirstResponder {return YES;}
(void)viewDidAppear:(BOOL)animated {[super viewDidAppear:animated];[self becomeFirstResponder];}
(void)viewWillDisappear:(BOOL)animated {[super viewWillDisappear:animated];[self resignFirstResponder];}
(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {NSLog(@"%s", __func__);}
This issue has been resolved. It’s not a problem with this third-party framework. Here’s the complete solution code:
Implemented in Appdelegate
//Support shaking
[[UIApplication sharedApplication] setApplicationSupportsShakeToEdit:YES];
Implement the following code in the controller that needs to be shaken:
(BOOL)canBecomeFirstResponder {
return YES;
}
(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self becomeFirstResponder];
}
(void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self resignFirstResponder];
}
(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
NSLog(@"%s", __func__);
}