调用另一个类的function(协议)

我有一个滑出导航面板(菜单)和另一个“菜单”在我的第一页。

在这里输入图像说明

滑出菜单:

  • 指数
  • 第1页
  • 第2页
  • 第3页
  • 第4页

在索引:

  • 第1页
  • 第2页
  • 第3页
  • 第4页

因此,用户可以从索引或滑动(或点击图标菜单)访问页面以获得菜单。

但我有一个错误:我从索引页1,我点击图标菜单滑出菜单,我点击索引,我再次从索引页1,在这里,如果我再次点击图标菜单,我得到错误:SIGBRT(类似的东西)

我做了一些断点:

在这一行: self.delegate?.pushViewControllerInStack!(UIStoryboard.nosOffresViewController(‌​)!)

还有一个在函数pushViewControllerInStack

而当我做操纵,我的应用程序读取这行self.delegate?.pushViewControllerInStack!(UIStoryboard.nosOffresViewController(‌​)!)但它不会在function。

所以我的观点lost the accessfunctionlost the access ,但我不知道为什么以及如何解决这个问题。

有很多代码,你可以在这里find一个git仓库: https : //github.com/Vkt0r/SlideOutSideBarTest

错误:

 2015-10-28 09:00:33.038 Solutis[477:5075] -[Solutis.NosOffresViewController menuNosOffresTapped:]: unrecognized selector sent to instance 0x7ff5caf464e0 2015-10-28 09:00:33.045 Solutis[477:5075] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Solutis.NosOffresViewController menuNosOffresTapped:]: unrecognized selector sent to instance 0x7ff5caf464e0' *** First throw call stack: ( 0 CoreFoundation 0x000000010f3b1f65 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000111268deb objc_exception_throw + 48 2 CoreFoundation 0x000000010f3ba58d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x000000010f307f7a ___forwarding___ + 970 4 CoreFoundation 0x000000010f307b28 _CF_forwarding_prep_0 + 120 5 UIKit 0x000000010fdf31fa -[UIApplication sendAction:to:from:forEvent:] + 92 6 UIKit 0x00000001101d5247 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 152 7 UIKit 0x000000010fdf31fa -[UIApplication sendAction:to:from:forEvent:] + 92 8 UIKit 0x000000010ff57504 -[UIControl sendAction:to:forEvent:] + 67 9 UIKit 0x000000010ff577d0 -[UIControl _sendActionsForEvents:withEvent:] + 311 10 UIKit 0x000000010ff5794b -[UIControl _sendActionsForEvents:withEvent:] + 690 11 UIKit 0x000000010ff56906 -[UIControl touchesEnded:withEvent:] + 601 12 UIKit 0x000000010fe5daa3 -[UIWindow _sendTouchesForEvent:] + 835 13 UIKit 0x000000010fe5e691 -[UIWindow sendEvent:] + 865 14 UIKit 0x000000010fe10752 -[UIApplication sendEvent:] + 263 15 UIKit 0x000000010fdebfcc _UIApplicationHandleEventQueue + 6693 16 CoreFoundation 0x000000010f2de0a1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 17 CoreFoundation 0x000000010f2d3fcc __CFRunLoopDoSources0 + 556 18 CoreFoundation 0x000000010f2d3483 __CFRunLoopRun + 867 19 CoreFoundation 0x000000010f2d2e98 CFRunLoopRunSpecific + 488 20 GraphicsServices 0x000000011485bad2 GSEventRunModal + 161 21 UIKit 0x000000010fdf1676 UIApplicationMain + 171 22 Solutis 0x000000010f1b892d main + 109 23 libdyld.dylib 0x0000000111d8092d start + 1 24 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) 

您将动作与酒吧项目相链接 您将动作与酒吧项目相链接

你评论说: 你评论它

所以当你尝试打开该页面的菜单时,它会崩溃。