我跟不上你的发香 2016-05-25 03:22 采纳率: 100%
浏览 5111

iOS开发 用masonry设置collection的高度时报错

设置make.height.mas_equalTo(500);后报错

 [self.view addSubview:self.categoryDetailView];
    [self.categoryDetailView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(64);
        make.right.mas_equalTo(0);
        make.width.mas_equalTo([UIScreen mainScreen].bounds.size.width-100);
        make.height.mas_equalTo(500);
    }];

下面是流水布局

 - (UICollectionViewFlowLayout *)flowlayout{
    if (!_flowlayout) {
        _flowlayout = [[UICollectionViewFlowLayout alloc]init];
        _flowlayout.sectionInset = UIEdgeInsetsMake(5, 5, 5, 5);
        _flowlayout.itemSize = CGSizeMake(100, 100);
        //横向间距
        _flowlayout.minimumInteritemSpacing = 5;
        //纵向间距
        _flowlayout.minimumLineSpacing = 10;
    }
    return _flowlayout;
}

下面是UICollectionView的初始化

 - (UICollectionView *)categoryDetailView{
    if (!_categoryDetailView) {


        _categoryDetailView = [[UICollectionView alloc]initWithFrame:CGRectZero collectionViewLayout:self.flowlayout];

        _categoryDetailView.delegate = self;
        _categoryDetailView.dataSource = self;
        _categoryDetailView.backgroundColor = [UIColor greenColor];

        [_categoryDetailView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"item"];
    }
    return _categoryDetailView;
}

错误描述* Assertion failure in -[MASViewConstraint setSecondViewAttribute:], /Users/a1/tuyy/ChinaUnion/ChinaUnion/Lib/Masonry/MASViewConstraint.m:130

真的纠结了,请大神帮我看看

  • 写回答

5条回答 默认 最新

  • qq_32749281 2016-06-02 01:30
    关注

    你好,解决了吗,我也遇到这样的问题了

    评论

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料