iOS报错日志- collectionview

来源:互联网 发布:自助认证发票软件 编辑:程序博客网 时间:2024/05/23 13:41

*** Assertion failure in -[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.29.5/UICollectionView.m:1536


collectionviewcontroller.view在原大小的controller中正常显示, 在一个较小的controller.view中作为子view加载时报以上错误


    UICollectionViewFlowLayout *flowLayout=[[UICollectionViewFlowLayoutalloc] init];

    flowLayout.headerReferenceSize =CGSizeMake(self.view.bounds.size.width,50);

错误定位到这个地方


解决:

    [selfaddChildViewController:self.collectionViewCntr];

    self.collectionViewCntr.view.frame =CGRectMake(0,0, SCREENWIDTH,self.view.bounds.size.height);

    [self.viewaddSubview:self.collectionViewCntr.view];

collectionviewcontroller需要作为子控制器添加,再添加其view,原因不清楚

0 0
原创粉丝点击