ShopCollectionViewLayout.h' file not found
老师,不知道为什么报错,这是ShopCollectionViewLayout.m
#import "ShopCollectionViewLayout.h"
#import "Util.h"
@interface ShopCollectionViewLayout(){
NSMutableArray *attsArray;
}
@end
@implementation ShopCollectionViewLayout
-(void)prepareLayout{
[super prepareLayout];
if (attsArray ==nil){
attsArray =[[NSMutableArray alloc]init];
}
NSInteger count = [self.collectionView numberOfItemsInSection:0];
for (int i =0;i<count ;i++){
NSIndexPath *indexPath =[NSIndexPath indexPathForItem:i inSection:0];
UICollectionViewLayoutAttributes *att = [self layoutAttributesForItemAtIndexPath:indexPath];
[attsArray addObject:att];
}
}
-(CGSize)collectionViewContentSize{
return CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT);
}
-(NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect{
return attsArray;
}
-(UICollectionViewLayoutAttributes *)
layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath{
UICollectionViewLayoutAttributes *att =[UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
CGFloat w =((SCREEN_WIDTH-32)/3);
CGFloat h = ((SCREEN_WIDTH-32)/3);
CGFloat x =8+(indexPath.row%3)*(w+8);
CGFloat y =8;
if (indexPath.row>=3){
y=16+h;
}
if (indexPath.row>=6){
y=24+h*2;
}
if (indexPath.row>=9){
y=32+h*3;
}
att.frame = CGRectMake(x, y, w, h);
return att;
}
@end
这是ShopCollectionViewLayout.h
#import <UIKit/UIKit.h>
@interface ShopCollectionViewLayout : UICollectionViewLayout
@end
这是"MsdViewController.m"在这里报的错 ShopCollectionViewLayout.h' file not found
#import "MsdViewController.h"
#import "Util.h"
#import "ShopCollectionViewLayout.h"
#import "ShopCollectionViewCell.h"
@interface MsdViewController ()<UICollectionViewDelegate,UICollectionViewDataSource>{
}
@property (nonatomic,copy)NSMutableArray *dataSourceArray;
@end
@implementation MsdViewController
正在回答 回答被采纳积分+1
- 参与学习 516 人
- 提交作业 158 份
- 解答问题 637 个
本路径采用基础+案例方式,助你解开对界面优化、数据储存、屏幕适配的疑惑。6小时团购项目实战加最新版本Swift讲解,让你掌握更多iOS开发技巧。
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星