2

这可能之前已经发布过,相信我我们尝试搜索并尝试了解决方案,但它无助于解决我们的问题(我将列出我们在 StackOverflow 上找到的内容)。

  1. 我们在 Xcode 9 中确实有一个示例项目,使用的是 Objective C。由 XIB 组成(我们不使用故事板,所以请不要回答与故事板或 swift 相关的问题)。AMSlideMenu 是使用 PODS 安装的

xcode 版本

  1. 我们的项目结构如下所示:

XCode 项目结构

AppDelegate 将 vcMain 和一个按钮将启动 vcClientMain。vcClientMain 是一个 AMSlideMenuMainViewController,应该有左右滑动菜单。

应用委托:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor whiteColor];

    vcMain *mainView = [[vcMain alloc] initWithNibName:@"vcMain" bundle:nil];
    self.window.rootViewController = mainView;
    [self.window makeKeyAndVisible];


    return YES;
}

vcMain 客户端按钮单击:

- (IBAction)btnClientClicked:(id)sender {
    vcClientMain *mainView = [[vcClientMain alloc] initWithNibName:@"vcClientMain" bundle:nil];

    [self presentViewController:mainView animated:true completion:nil];
}
  1. prefix.pch 文件包含我们从 AMSSlideMenu 的 withoutstoryboad 示例中复制的代码(包含在实际项目和 pods 项目中)

    #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
    
  2. 单击客户端按钮时,我们收到此错误

    2018-01-14 03:44:17.102821+0800 Travellogger [5275:1112453] *** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“接收者()没有标识符为“rightMenu”的segue”
*** 首先抛出调用堆栈:
(
    0 核心基础 0x00000001064a312b __exceptionPreprocess + 171
    1 libobjc.A.dylib 0x000000010a957f41 objc_exception_throw + 48
    2 UIKit 0x000000010822e3d0-[UIViewController shouldPerformSegueWithIdentifier:sender:] + 0
    3 Travellogger 0x00000001060a36f7 -[AMSlideMenuMainViewController 设置] + 1063
    4 旅行记录器 0x00000001060a09a3 -[AMSlideMenuMainViewController viewDidLoad] + 387
    5 旅行记录器 0x000000010609e7d3 -[vcClientMain viewDidLoad] + 275
    6 UIKit 0x000000010822b46c-[UIViewController loadViewIfRequired] + 1235
    7 UIKit 0x000000010822b8b9 -[UIViewController 视图] + 27
    8 UIKit 0x0000000108cc4441-[_UIFullscreenPresentationController _setPresentedViewController:] + 89
    9 UIKit 0x00000001081f82a3-[UIPresentationController initWithPresentedViewController:presentingViewController:] + 133
    10 UIKit 0x000000010823eb67-[UIViewController _presentViewController:withAnimationController:completion:] + 3808
    11 UIKit 0x00000001082419a9 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 99
    12 UIKit 0x0000000108242079-[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 532
    13 UIKit 0x0000000108241908-[UIViewController _presentViewController:animated:completion:] + 181
    14 UIKit 0x0000000108241c67-[UIViewController presentViewController:animated:completion:] + 159
    15 旅行记录器 0x000000010609b8f8 -[vcMain btnClientClicked:] + 120
    16 UIKit 0x0000000108084972-[UIApplication sendAction:to:from:forEvent:] + 83
    17 UIKit 0x0000000108203c3c-[UIControl sendAction:to:forEvent:] + 67
    18 UIKit 0x0000000108203f59-[UIControl_sendActionsForEvents:withEvent:] + 450
    19 UIKit 0x0000000108202981-[UIControl touchesBegan:withEvent:] + 282
    20 UIKit 0x00000001080fa562-[UIWindow_sendTouchesForEvent:] + 2130
    21 UIKit 0x00000001080fbf2a -[UIWindow 发送事件:] + 4124
    22 UIKit 0x000000010809f365-[UIApplication sendEvent:] + 352
    23 UIKit 0x00000001089eba1d __dispatchPreprocessedEventFromEventQueue + 2809
    24 UIKit 0x00000001089ee672 __handleEventQueueInternal + 5957
    25 核心基础 0x0000000106446101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    26 核心基础 0x00000001064e5f71 __CFRunLoopDoSource0 + 81
    27 核心基础 0x000000010642aa19 __CFRunLoopDoSources0 + 185
    28 核心基础 0x0000000106429fff __CFRunLoopRun + 1279
    29 核心基础 0x0000000106429889 CFRunLoopRunSpecific + 409
    30 图形服务 0x000000010dfee9c6 GSEventRunModal + 62
    31 UIKit 0x00000001080835d6 UIApplicationMain + 159
    32 旅行记录器 0x000000010609e69f 主要 + 111
    33 libdyld.dylib 0x000000010b721d81 开始 + 1
)
libc++abi.dylib:以 NSException 类型的未捕获异常终止
  1. 以下是我们在 Stackoverflow 上研究的一些内容,但遗憾的是没有完成这项工作:

iOS AMSlideMenu Receiver () 没有标识符为“rightMenu”的segue

AMSlideMenu 崩溃:Receiver () 没有带有标识符“rightMenu”的segue

  1. Youtube视频也不起作用
4

1 回答 1

0

This is a very easy to integrate and smooth slide menu

https://github.com/beingbarath/BMSlideMenu

enter image description here

Integration of SWRevealViewController. Hope this helps :)

于 2018-01-14T07:41:28.123 回答