0

我正在使用RNBLueModalView使用以下代码呈现新的模态视图:

    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]];
    smallStoreViewController *Store = [[smallStoreViewController alloc]init];

    Store = [storyBoard instantiateViewControllerWithIdentifier:@"small store"];

    RNBlurModalView *mod = [[RNBlurModalView alloc] initWithViewController:self view:Store.view];

    [mod show];

smallStoreViewController 视图中有六个按钮,但是当我按下其中任何一个按钮时,我都会收到 lldb 异常 - (按钮名称)无法识别的选择器发送到实例。当我使用模态视图的默认presentedViewController方法)呈现时,一切正常。这是非常奇怪的行为,因为我在以前的项目中使用过这种方法,并且一切正常。

关于我在哪里可以找到此异常原因的任何建议?

4

1 回答 1

0

所以我找到了解决方案:我应该保留我的smallStoreViewController. 我猜发生错误是因为将其分配Store为局部变量,并且在按下模态视图的按钮时它不在身边。(错误表明内存已被释放并重新用于不同类型的对象。)

于 2013-04-25T23:10:27.030 回答