写一个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
请教各位怎么回事
1
DavidHu OP = =自己顶一下,还是没解决问题啊……
|