Skip to content
New issue

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

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

Open
zgGitHub opened this issue Jul 5, 2023 · 0 comments

Comments

@zgGitHub
Copy link

zgGitHub commented Jul 5, 2023

我感觉通过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];
   }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant