我的iOS應用程序崩潰,並顯示以下異常:「no UICollectionViewLayoutAttributes實例」是什麼意思?
void HandleExceptions(NSException *__strong):875 ERROR: uncaught exception: no UICollectionViewLayoutAttributes instance for -layoutAttributesForDecorationViewOfKindOfKind: ColorDecoratorView at path <NSIndexPath: 0x7d843ec0> {length = 3, path = 3 - 0}
能否請你告訴我什麼是「不UICollectionViewLayoutAttributes實例-layoutAttributesForDecorationViewOfKindOfKind」的含義?我應該在哪裏尋找麻煩拍攝它?
我已經implmenemtned這個方法:
- (UICollectionViewLayoutAttributes *)layoutAttributesForDecorationViewOfKind:(NSString *)decorationViewKind atIndexPath:(NSIndexPath *)indexPath
,但我得到以下情況例外,當我旋轉屏幕:
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
謝謝。
謝謝。我已經暗示了你所建議的方法。但是當我將模擬器從Protait旋轉到風景時,我遇到了新的崩潰。我已經更新了我的問題。 – michael 2015-01-10 01:42:39