3

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

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

我该如何解决?

谢谢,

4

6 回答 6

4

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

Segue 视图修复

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

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

于 2014-07-10T05:38:27.280 回答
0

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

于 2014-11-16T14:03:08.643 回答
0

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

于 2015-03-01T18:40:25.543 回答
0

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

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

在你的 PCH 文件中添加这个#define AMSlideMenuWithoutStoryboards

我希望它可以毫无问题地工作。

于 2015-07-23T11:36:18.137 回答
0

AMSlideMenu 创建者建议添加:

#define AMSlideMenuWithoutStoryboards

在项目的 pch 上。

我已经尝试过这个解决方案,但绝对行不通。
如本文所述,如果您使用 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

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

于 2016-11-21T13:59:21.580 回答
0

如果您使用 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 
于 2020-04-15T17:27:07.450 回答