objective-c - iOS 侧滑框架MMDrawerController与摇一摇的冲突
迷茫
迷茫 2017-04-18 09:05:05
0
1
367

项目中用到了MMDrawerController这个侧滑框架,今天在做一个摇一摇的功能.项目框架图请看:

蓝色框的代码是实现摇一摇功能,在没有使用MMDrawerController的情况下亲测是成功的。
但在使用MMDrawerController后,检测不到摇一摇,实现不了,各位看官有遇到过吗?在线等

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
小葫芦

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__);
    }

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template