Open zgGitHub opened 1 year ago
我感觉通过getCurrentVC方法,获取到的Controller 不一定是菜单所在的 Controller,也许是我用错了,希望作者能提出指导
getCurrentVC
代码位置:WMZDropDownMenu.m 文件的 menuTitle 方法里面,232 行
if([[WMZDropMenuTool getCurrentVC] respondsToSelector:@selector(viewWillDisappear:)] || [[WMZDropMenuTool getCurrentVC] respondsToSelector:@selector(viewDidDisappear:)]){ ///hook监听当前控制器消失 @MenuWeakSelf(self); [[WMZDropMenuTool getCurrentVC] aspect_hookSelector:@selector(viewWillDisappear:) withOptions:AspectOptionAutomaticRemoval usingBlock:^(id<AspectInfo> aspectInfo){ @MenuStrongSelf(self); if(!self.close){ self.hook = YES; [self closeView]; self.hook = NO; } } error:NULL]; [[WMZDropMenuTool getCurrentVC] aspect_hookSelector:@selector(viewDidDisappear:) withOptions:AspectOptionAutomaticRemoval usingBlock:^(id<AspectInfo> aspectInfo){ @MenuStrongSelf(self); if(!self.close){ self.hook = YES; [self closeView]; self.hook = NO; } } error:NULL]; }
我感觉通过
getCurrentVC
方法,获取到的Controller 不一定是菜单所在的 Controller,也许是我用错了,希望作者能提出指导代码位置:WMZDropDownMenu.m 文件的 menuTitle 方法里面,232 行