wwmz / WMZDropDownMenu

🌹一个能几乎实现所有App各种类型筛选菜单的控件,可悬浮,目前已实现闲鱼/美团/Boss直聘/京东/饿了么/淘宝/拼多多/赶集网/美图外卖等等的筛选菜单,可以自由调用代理实现自己想组装的筛选功能和UI,且控件的生命周期自动管理,悬浮自动管理🌹(A control that can implement almost all types of filtering menus of all apps)
MIT License
725 stars 98 forks source link

下面的代码,当菜单不在当前页面的时候,刷新菜单 UI,会导致崩溃在 ViewDidDisappear 里面 #63

Open zgGitHub opened 1 year ago

zgGitHub commented 1 year ago

我感觉通过getCurrentVC方法,获取到的Controller 不一定是菜单所在的 Controller,也许是我用错了,希望作者能提出指导

代码位置: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];
   }