简体   繁体   English

从NavigationBarItem到UINavigationViewController的Segue

[英]Segue from NavigationBarItem to UINavigationViewController

I have a tutorial and at the end of the tutorial I want to push from a UIViewController to a UINavigationViewController. 我有一个教程,在该教程的结尾,我想从UIViewController推送到UINavigationViewController。 I need the UINavigationViewController because I'm using ECSlidingViewController . 我需要UINavigationViewController,因为我正在使用ECSlidingViewController The view which is managed by this UINavigationViewController is a UITableViewController. 由此UINavigationViewController管理的视图是UITableViewController。 Okay so far everything is easy to understand right? 好吧,到目前为止,一切都很容易理解,对吗? No problem. 没问题。 But now it gets weird. 但是现在变得奇怪了。 Now I use this code (IBAction): 现在,我使用以下代码(IBAction):

HomeNavViewController *home = [[HomeNavViewController alloc] init];
[self presentModalViewControllerhome animated:YES];

Everything I get is an app termination from the debugger. 我得到的一切都是来自调试器的应用终止。 Does anyone have experienced this already? 有人已经经历过吗?

Thanks in advance for any help :) 在此先感谢您的帮助:)

Here is the error message (sorry I forgot to post it in the first place :) ): 这是错误消息(对不起,我忘了先发布它:)):

2013-05-14 16:43:07.313 187ers[1124:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x2c3e012 0x210be7e 0x2bf1b6a 0x2bf1a20 0x2aca3f 0xeac4 0x340103 0x34042b 0x34df80 0x54a223 0x346ee3 0x347167 0x3471a7 0xe4cc 0x211f705 0x2602c0 0x49ca64 0x211f705 0x2602c0 0x260258 0x321021 0x32157f 0x3206e8 0x28fcef 0x28ff02 0x26dd4a 0x25f698 0x2b99df9 0x2b99ad0 0x2bb3bf5 0x2bb3962 0x2be4bb6 0x2be3f44 0x2be3e1b 0x2b987e3 0x2b98668 0x25cffc 0x2e4d 0x2d75)
libc++abi.dylib: terminate called throwing an exception
(lldb) 

Your error is caused by an illegal operation on an NSMutableArray (you try to insert a nil object in NSMutableArray). 您的错误是由对NSMutableArray的非法操作引起的(您尝试在NSMutableArray中插入nil对象)。 Check your code HomeNavViewController `viewDidLoad/viewWillAppear/viewDidAppear (if you implement them) and make sure that you don't try to insert nil objects into an array 检查您的代码HomeNavViewController / viewWillAppear / viewDidAppear(如果实现了它们),并确保不要尝试将nil个对象插入数组中

Also if you execute code after [self presentModalViewControllerhome animated:YES]; 另外,如果您在[self presentModalViewControllerhome animated:YES];之后执行代码[self presentModalViewControllerhome animated:YES]; check for the same problem insert nil object into NSMutableArray. 检查是否存在相同问题,将nil对象插入NSMutableArray。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UINavigationViewController控件UIContainerView嵌入segue - UINavigationViewController control UIContainerView embed segue 从UIImageView类访问UINavigationViewController - Access UINavigationViewController from UIImageView class 在UINavigationViewController上推送(推送segue)视图后,方向不会改变 - Orientation doesn't change after Pushing (push segue) a View on the UINavigationViewController 在 SwiftUI 中从 NavigationBarItem 菜单显示不同的视图 - Show different views from NavigationBarItem menu in SwiftUI 从InterfaceBuilder修改UINavigationViewController的UIToolBar - Modify a UINavigationViewController's UIToolBar from InterfaceBuilder 通过UINavigationViewController将数据从幻灯片菜单传递到UITableViewController - Passing Data from Slide menu to UITableViewController through UINavigationViewController 推送到UINavigationViewController - Pushing to UINavigationViewController UINavigationViewController 中的 UIInterfaceOrientation - UIInterfaceOrientation in UINavigationViewController 我怎么知道`UIViewController`刚从`UINavigationViewController`推出? - How can I know when a `UIViewController` has been just pushed from a `UINavigationViewController`? 从popover segue推推segue不起作用 - Push segue from popover segue does not work
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM