【问题标题】:iOS AMSlideMenu Receiver (<MainVC: 0x8f92a90>) has no segue with identifier 'rightMenu''iOS AMSlideMenu 接收器 (<MainVC: 0x8f92a90>) 没有带有标识符“rightMenu”的segue
【发布时间】:2014-07-07 21:09:15
【问题描述】:

我想使用库 AMSlideMenu 来创建一个导航抽屉。我看到了 YT 教程,用它制作了我自己的导航抽屉。

问题是,我只想使用左侧菜单,所以出现了这个错误,因为它没有找到右侧菜单...

我该如何解决?

谢谢,

【问题讨论】:

  • 这很奇怪,因为如果我添加一个带有标识符 rightMenu 的 segue 视图,我仍然会遇到同样的错误......
  • 老实说,你的评论对我没有帮助,谢谢。对不起,如果我没有你的水平。
  • @deveLost 运气好吗?我遇到了同样的问题,即使按照教程@youtube.com/watch?v=y33t_bWS_Zk

标签: ios objective-c navigation amslidemenu


【解决方案1】:

我通过仔细检查我的 Segue 类设置是否正确来解决此问题。单击表格视图和 segue 视图之间的 segue 链接,并确保已将类设置为“AMSlideMenuContentSegue”和正确的标识符(“firstSegue”、“secondSegue”):

在此链接之前,MainVC(或等效的)视图与菜单链接的表视图保持一致,应将其类设置为“AMSlideMenuLeftMenuSegue”,并将其标识符设置为“leftMenu;

此外,如果上述所有内容都已在您的代码中检出,那么这个已解决的问题可能会提供您想要的解决方案:https://github.com/SocialObjects-Software/AMSlideMenu/issues/21

【讨论】:

    【解决方案2】:

    我有同样的问题。 如果 AMSlideMenu 在尝试创建 LeftMenu 时捕获异常,则尝试创建 RightMenu(我不明白为什么,但确实如此)。 在我的情况下,左侧菜单“firstSegue”指向“错误视图”,因为它是一个简单的视图控制器而不是导航控制器。 我将视图控制器更改为导航控制器(指向我原来的视图控制器),修复它。 对不起我的英语...

    【讨论】:

      【解决方案3】:

      将 AMSlideMenuWithoutStoryboard-Prefix.pch 文件设置复制到项目中的 PCH 文件中。

      【讨论】:

        【解决方案4】:

        我刚刚在我的项目中修复了它。我希望解决方案对你们有效:

        只需添加一个新的.pch 文件,然后转到Build Settings 选项卡,搜索“前缀标题”并设置路径。

        在您的 PCH 文件中添加 #define AMSlideMenuWithoutStoryboards

        我希望它可以正常工作。

        【讨论】:

          【解决方案5】:

          AMSlideMenu 创建者建议添加:

          #define AMSlideMenuWithoutStoryboards
          

          在项目的 pch 上。

          我已经尝试过这个解决方案,但绝对行不通。
          正如post 中所解释的,如果您使用 cocoapod 安装 AMSlideMenu,则必须在 pod 项目的 .pch 文件中定义 AMSlideMenuWithoutStoryboards

          这是一个邪恶的解决方法:每次运行 pod update 时,您都应该记得在 AMSlideMenu .pch 文件中手动添加该行。

          我的解决方案是在项目构建阶段添加运行脚本,在我的情况下是:

          output=$(find .. -name "AMSlideMenu-prefix.pch")
          source=${SRCROOT}/${PROJECT_NAME}/amSlideMenuConfig
          log=${SRCROOT}/${PROJECT_NAME}/MyProject.log
          
          echo -e "Configuring AMSlideMenu" > ${log}
          echo -e "Reading configuration from: " "${source}" "\n" >> ${log}
          echo "$(cat ${source})" > "${output}"
          echo -e "Project configured.    " >> ${log}
          

          其中 amSlideMenuConfig 包含旧定义:

          #import <Availability.h>
          
          #ifndef __IPHONE_5_0
          #warning "This project uses features only available in iOS SDK 5.0 and later."
          #endif
          
          #define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
          #define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
          #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
          #define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
          #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
          
          #define AMSlideMenuWithoutStoryboards
          
          #ifdef __OBJC__
          #import <UIKit/UIKit.h>
          #import <Foundation/Foundation.h>
          #endif
          

          每次构建项目时都会执行此脚本:为了改进优化过程,您可以在脚本中添加您需要的任何检查。

          【讨论】:

            【解决方案6】:

            如果您使用 pod 安装 AMSlideMenu 而您没有使用 Storyboard 来配置它,这就是解决方案,我在很多地方搜索过,并结合了很多答案,所以最后,这适用于我,只需将其添加到您的 PodFile 中

            我希望它对你有用...

                post_install do |installer_representation|
                    #fix for AMSlideMenu
                    define = "#define AMSlideMenuWithoutStoryboards" +"\n\n"+
                        "#define SYSTEM_VERSION_LESS_THAN(v)          ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)" + "\n" +
                      "#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)" + "\n" +
                        "#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)" + "\n" +
                        "#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)" + "\n" +
                        "#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)" + "\n" +
                        "#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)"
            
                    directory = installer_representation.config.project_pods_root + 'Target Support Files/'
                    info_plist_path = directory + "AMSlideMenu/AMSlideMenu-prefix.pch"
            
                    text = File.read(info_plist_path)
                    new_contents = text+define
                    File.open(info_plist_path, "w") {|file| file.puts new_contents }
            
                end 
            

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 2014-06-10
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2012-08-06
              • 1970-01-01
              相关资源
              最近更新 更多