使用instantiateViewControllerWithIdentifier实例化的无响应视图:

时间:2013-04-20 11:44:26

标签: ios objective-c xcode cocoa-touch

我遇到一些问题,我需要从故事板ID中实例化。在IOS模拟器中,视图会加载所有内容但完全没有响应。日期选择器不会移动,按钮也不接受任何交互。

我已经检查了IB中的'自定义类'匹配和Storyboard ID匹配。代码正在PickerViewController中执行,因为UIDatePicker是在代码中创建的,并且是正确的,并且存在于IOS模拟器中。它只是没有任何接受任何互动。触摸时按钮甚至不会变为蓝色。

我使用以下命令在上一个视图控制器中创建了视图:

PickerViewController *addViewController = (PickerViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"view"];

[addViewController.view setUserInteractionEnabled:TRUE];//chucked this line in to see if it helped


[addViewController setModalPresentationStyle:UIModalPresentationFormSheet];
[self presentViewController:addViewController animated:YES completion:NULL];

我不确定这是代码问题,还是我没有正确地在IB中搞定。任何想法?? !!

1 个答案:

答案 0 :(得分:0)

在助理编辑器中检查您的视图控制器类:

enter image description here

相关问题