We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
简书地址:https://www.jianshu.com/p/9769337d297f
解决方法是用的@icetime17的,只是代码放的位置不太一样,他的RootViewController是继承自RESideMenu的,而我是自己写了个RESideMenu的分类进行设置的。
关键代码就👇几句:
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(disableRESideMenu) name:@"disableRESideMenu" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enableRESideMenu) name:@"enableRESideMenu" object:nil];
}
-(void)enableRESideMenu
{ self.panGestureEnabled = YES;}
-(void)disableRESideMenu
{ self.panGestureEnabled = NO;}
分类设置完后,在需要关闭侧滑菜单的界面执行👇
[[NSNotificationCenter defaultCenter] postNotificationName:@"disableRESideMenu" object:nil];
为什么我要把代码放在viewWillAppear里呢?
尝试放在viewDidLoad里面,但是程序运行起来黑屏;
尝试放在+(void)load方法里面,但是崩在发送通知的方法,提示找不到disableRESideMenu方法,为什么呢?因为+(void)load是类方法,不能在里面直接使用对象方法- (void)enableRESideMenu。
因此,我尝试了一下放在viewWillAppear里面。。。完美解决!!!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
简书地址:https://www.jianshu.com/p/9769337d297f
解决方法是用的@icetime17的,只是代码放的位置不太一样,他的RootViewController是继承自RESideMenu的,而我是自己写了个RESideMenu的分类进行设置的。
关键代码就👇几句:
-(void)viewWillAppear:(BOOL)animated
{
}
-(void)enableRESideMenu
{ self.panGestureEnabled = YES;}
-(void)disableRESideMenu
{ self.panGestureEnabled = NO;}
分类设置完后,在需要关闭侧滑菜单的界面执行👇
[[NSNotificationCenter defaultCenter] postNotificationName:@"disableRESideMenu" object:nil];
为什么我要把代码放在viewWillAppear里呢?
尝试放在viewDidLoad里面,但是程序运行起来黑屏;
尝试放在+(void)load方法里面,但是崩在发送通知的方法,提示找不到disableRESideMenu方法,为什么呢?因为+(void)load是类方法,不能在里面直接使用对象方法- (void)enableRESideMenu。
因此,我尝试了一下放在viewWillAppear里面。。。完美解决!!!
The text was updated successfully, but these errors were encountered: