遇到一个 unrecognized selector sent to instance 的问题

2015-05-04 00:25:02 +08:00
 DavidHu

写一个collectionViewController, 调用他的dataSource里面的一个自定义函数,结果调用不到,然后就crash了。

//ClassCalendarCollectionViewController.m
ClassCalendarDataSource *classDataSource = (ClassCalendarDataSource *)self.collectionView.dataSource;
classDataSource.configureWeekViewBlock = ^(WeekReuse *weekReuseView, NSString *kind, NSIndexPath *indexPath) {
if ([kind isEqualToString:@"WeekReuse"]) {
            for (int i = 0; i < 7; i++) {
                NSLog(@"will print: %@", weekDay[i]);
                weekReuseView.WeekTitle.text = [NSString stringWithFormat:weekDay[i], indexPath.item +1];
            }
        }
    };

//ClassCalendarDataSource.h
typedef void (^ConfigureWeekViewBlock)(WeekReuse *weekReuseView, NSString *kind, NSIndexPath *indexPath);
@interface ClassCalendarDataSource : NSObject <UICollectionViewDataSource>
@property (copy, nonatomic) ConfigureWeekViewBlock configureWeekViewBlock;
@end

这个是在学习着一个GitHub的项目在写,前辈指点我说要有这个函数的实现才行,但是原项目就没有实现,只是在几个需要的地方调用了一下
原项目地址: https://github.com/objcio/issue-3-collection-view-layouts.git
请教各位怎么回事

2413 次点击
所在节点    iDev
1 条回复
DavidHu
2015-05-05 15:18:46 +08:00
= =自己顶一下,还是没解决问题啊……

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/188224

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX