Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios “是什么意思?”;没有UICollectionViewLayoutAttribute实例“;?_Ios - Fatal编程技术网

Ios “是什么意思?”;没有UICollectionViewLayoutAttribute实例“;?

Ios “是什么意思?”;没有UICollectionViewLayoutAttribute实例“;?,ios,Ios,我的ios应用程序崩溃,出现以下异常: void HandleExceptions(NSException *__strong):875 ERROR: uncaught exception: no UICollectionViewLayoutAttributes instance for -layoutAttributesForDecorationViewOfKindOfKind: ColorDecoratorView at path <NSIndexPath: 0x7d843ec0>

我的ios应用程序崩溃,出现以下异常:

void HandleExceptions(NSException *__strong):875 ERROR: uncaught exception: no UICollectionViewLayoutAttributes instance for -layoutAttributesForDecorationViewOfKindOfKind: ColorDecoratorView at path <NSIndexPath: 0x7d843ec0> {length = 3, path = 3 - 0}
但当我旋转屏幕时,会出现以下异常:

uncaught exception: layout attributes for supplementary item at index path (<NSIndexPath: 0x79ef2c80> {length = 2, path = 1 - 0}) changed from <UICollectionViewLayoutAttributes: 0x82e76830> index path: (<NSIndexPath: 0x79ebf750> {length = 2, path = 1 - 0}); element kind: (ColorDecoratorView); frame = (72 2513; 293.333 252);  to <UICollectionViewLayoutAttributes: 0x79ef9380> index path: (<NSIndexPath: 0x79ef2c80> {length = 2, path = 1 - 0}); element kind: (ColorDecoratorView); frame = (0 825; 1024 -327);  without invalidating the layout
uncaught异常:索引路径({length=2,path=1-0})处补充项的布局属性已从索引路径({length=2,path=1-0})更改;元素种类:(ColorDecoratorView);帧=(722513;293.333252);索引路径:({length=2,path=1-0});元素种类:(ColorDecoratorView);帧=(0825;1024-327);不会使布局无效

谢谢。

您正在实施此方法吗

-(UICollectionViewLayoutAttributes*)layoutAttributesForDecorationViewOfKind:(NSString*)decorationViewKind atIndexPath:(NSIndexPath*)indexPath

返回值为

包含应用于装饰视图的信息的布局属性对象。

我要说的是实现这个方法。像这样的
UICollectionViewLayoutAttributes*attrs=[UICollectionViewLayoutAttributes LayoutAttributes ForDecorationViewOfKind:decorationViewKind with indexPath:indexPath];
attrs.frame=cgrectmake(x,x,x,x);
返回属性

看起来您的单元格正在从集合视图中请求某些LayoutAttribute。 nsindepath似乎是[L=3,path=3]


获取indexPath.row并在cellforrowatinexpath中进一步调查。

谢谢。我已经实施了你建议的方法。但当我把模拟器从Protait旋转到scape时,我又遇到了一个新的崩溃。我已经更新了关于坠机的问题。
uncaught exception: layout attributes for supplementary item at index path (<NSIndexPath: 0x79ef2c80> {length = 2, path = 1 - 0}) changed from <UICollectionViewLayoutAttributes: 0x82e76830> index path: (<NSIndexPath: 0x79ebf750> {length = 2, path = 1 - 0}); element kind: (ColorDecoratorView); frame = (72 2513; 293.333 252);  to <UICollectionViewLayoutAttributes: 0x79ef9380> index path: (<NSIndexPath: 0x79ef2c80> {length = 2, path = 1 - 0}); element kind: (ColorDecoratorView); frame = (0 825; 1024 -327);  without invalidating the layout