我想使用库AMSlideMenu来创建导航抽屉。我看到YT教程用它制作了我自己的导航抽屉。
问题是,我只想使用左侧菜单,所以我发现了这个错误,因为它没有找到合适的菜单......
我该如何解决?
THX,
答案 0 :(得分:4)
我通过仔细检查我的Segue Class是否设置正确来解决这个问题。单击表格视图和segue视图之间的segue链接,并确保已将类设置为“AMSlideMenuContentSegue”'和正确的标识符(' firstSegue',' secondSegue'):
在此链接之前,MainVC(或等效)视图将转换为菜单链接的表格视图,应该将其类别设置为“AMSlideMenuLeftMenuSegue”' AMSlideMenuLeftMenuSegue'并且它的标识符设置为' leftMenu;
此外,如果以上所有内容都在您的代码中检出,则此已解决的问题可能会包含您之后的解决方案:https://github.com/SocialObjects-Software/AMSlideMenu/issues/21
答案 1 :(得分:0)
我有同样的问题。 如果AMSlideMenu在尝试创建LeftMenu时捕获异常,则尝试创建RightMenu(我不明白为什么,但是为真)。 在我的情况下,左侧菜单“firstSegue”指向“错误视图”,因为它是一个简单的视图控制器而不是导航控制器。 我将视图控制器更改为导航控制器(指向我的原始视图控制器),修复它。 我的英语... ...
答案 2 :(得分:0)
将AMSlideMenuWithoutStoryboard-Prefix.pch文件设置复制到项目中的PCH文件中。
答案 3 :(得分:0)
我刚刚修改了我的项目。我希望这个解决方案对你们有用:
只需添加一个新的.pch
文件,然后转到Build Settings
标签,搜索“前缀标题”并设置路径。
在您的PCH文件中添加此#define AMSlideMenuWithoutStoryboards
我希望它可以毫无问题地工作。
答案 4 :(得分:0)
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
每次构建项目时都会执行此脚本:为了改进流程优化,您可以在脚本中添加所需的任何检查。
答案 5 :(得分: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