【发布时间】:2016-02-03 01:27:02
【问题描述】:
我正在尝试将字符串从 ViewController (VC) 传递给 CollectionViewController (CVC)
我在 VC 上有一个 UIButton,触发 segue 的 show 链接到 CVC。
在我的 VC 中,我有 prepareForSegue 如下
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"gotoImages"]) {
CQTaskPhotosCVC *vc = segue.destinationViewController;
vc.queueID = _idCode;
}
}
在我的 CVC.h 中
@interface CQTaskPhotosCVC : UICollectionViewController
@property (nonatomic, strong) NSString *queueID;
@end
这是我得到的错误
2016-02-02 12:05:45.015 CactusQueue[41739:6063627] -[UICollectionViewController setQueueID:]:无法识别的选择器发送到实例 0x12836e410
2016-02-02 12:05:45.017 CactusQueue[41739:6063627] *** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[UICollectionViewController setQueueID:]:无法识别的选择器发送到实例 0x12836e410”
我以前使用 segues 在 VC 之间传递数据,但从未遇到过这个问题。删除vc.queueiD = _idCode; 不会导致崩溃,所以我不知道我是否只是忽略了一些愚蠢的事情或什么。
做什么?
【问题讨论】:
-
您确定在 InterfaceBuilder 的 Storyboard 中为您的
UIViewController到CQTaskPhotosCVC设置了正确的类吗? -
原来如此。天哪,我需要一些咖啡......或者睡觉。谢谢
标签: ios objective-c segue