iphone - dismissModalViewControllerAnimated使我的应用程序崩溃:(

标签 iphone cocoa-touch uikit ipad crash

我正在创建一个iPad应用程序,并且有两个类:NWRootViewController : UITableViewControllerUINewFeedViewController : UIViewController。在NWRootViewController中,我有一个UIBarButtonItem,当点击它时,会弹出一个名为NWNewFeedViewController的模式 View Controller :

// THIS CODE IS IN NWROOTVIEWCONTROLLER.M
// New Feed
-(IBAction)showNewFeedViewAction:(id)sender {
    [newFeedViewController setModalPresentationStyle:UIModalPresentationFormSheet];
    [self presentModalViewController:newFeedViewController animated:YES];
}

这很好。但是,在NWNewFeedViewController的 View 中,我还有另一个UIBarButtonItem在点击时执行此操作:
// THIS CODE IS IN NWNEWFEEDCONTROLLER.M
// Buttons
-(IBAction)cancelAction:(id)sender {
    [self dismissModalViewControllerAnimated:YES];
}

当我点击此按钮时,应用程序崩溃并显示:
2010-04-10 12:39:46.703 News[580:207] *** -[NWDetailViewController cancelAction:]: unrecognized selector sent to instance 0x4741110
2010-04-10 12:39:46.705 News[580:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NWDetailViewController cancelAction:]: unrecognized selector sent to instance 0x4741110'
2010-04-10 12:39:46.705 News[580:207] Stack: (
    40878667,
    2458187017,
    41150267,
    40613142,
    40609810,
    2776006,
    4876265,
    2776006,
    3246293,
    3255055,
    3250242,
    2899304,
    2793965,
    2825287,
    49238396,
    40419388,
    40415304,
    49232029,
    49232226,
    2817505
)

谁能帮我?谢谢

最佳答案

您的“取消”按钮具有您的详细信息 Controller 的目标;您的目标是定位新的Feed Controller 。因此,请检查您如何配置取消按钮。

关于iphone - dismissModalViewControllerAnimated使我的应用程序崩溃:(,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2613071/

相关文章:

objective-c - 如何检查 NSMutableArray 中是否存在对象

ios - 在单元格中异步加载图像的 UITableView - 图像在慢速连接时不断变化

ios - 我应该如何将 OpenGL 模型 View 转换为 CATransform3D?

iphone - 为什么sqlite只插入一列?

iPhone 耳机插孔 - 读取数据?

iphone - 找出哪些编译选项用于构建 SQLite 的方法

ios - UIButton 在 UITableView 中不工作(点击时崩溃)?我能得到一些关于 obj-c 的帮助吗

ios - 如何将按钮移动到随机位置? ( swift )

iphone - 检测低电量警告ios

iOS:创建另一个 UIWindow 作为覆盖时出现问题(iOS 7 问题?)