masonry报'attempting to add unsupported attribute: (null)'
来源:互联网 发布:js按钮current trigger 编辑:程序博客网 时间:2024/05/22 01:30
masonry遇到这样的报错
分析一下 通常遇到这样的错误,是因为约束冲突,或者约束不全。这就需要找到崩溃的地方,仔细分析代码:
for (int i = 1 ; i < datacount; i++) { DataModel * dataModel = self.DataArray[i]; int subDataCount = (int)dataModel.sum_data.count; int lineCount =(subDataCount%3)==0?subDataCount/3: subDataCount/3 +1; DataBGView * BGview = [DataBGView new]; [_secondDataView addSubview:BGview]; [BGview mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(0); make.height.equalTo(KSDataViewWidth*lineCount); if (i == 0) { //第一个视图 make.top.equalTo(0); }else{ make.top.equalTo(lastView.mas_bottom); } }];
代码为for循环添加代码。可以看到 我们循环从1 开始 但是后面的视图都是根据0视图来约束的。而只有0视图有根据父视图的约束。这就造成了。缺少约束。导致崩溃。修改代码 i==0为i ==1即可,或者从第0次开始循环。之所以项目从1开始循环,因为战士的时候,需要从数组1的数据开始展示,数组0的数据需要舍弃。所以面对这种特别的需求。就特别要注意约束的完整性。否则就会出现上述报错。
阅读全文
0 0
- masonry报'attempting to add unsupported attribute: (null)'
- 使用Masonry蹦到布局崩到 NSAssert(NO, @"attempting to add unsupported attribute: %@", secondViewAttribute);
- pyqt 出现Attempting to add QLayout
- You are attempting to build with an unsupported JDK.
- How to add AD attribute?
- 【Tensorflow】报错:FailedPreconditionError: Attempting to use uninitialized value keep_prob_7
- Android报错android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for
- android报错——Unable to add window -- token null is not for an application
- Qt:Attempting to add QLayout "" to MainWindow "", which already has a layout
- qt QLayout: Attempting to add QLayout "" to MainWindow "", which already has a layout. 错误
- Dialog(四)——报错Unable to add window -- token null is not for an application
- 使用Masonry报unrecognized selector sent to instance的错
- Attempting to add QLayout "" to MainWindow "", which already has a layout 给QWidget或者QDialog设置布局的时候方
- [Vertica报错]Spread error; can't determine which DBs are running; attempting to continue... '
- python报错ImportError: [joblib] Attempting to do parallel computing without protecting
- 安卓开发——报错:Attempt to invoke interface method 'boolean java.util.List.add(java.lang.Object)' on a null
- Unable to add window -- token null is not valid
- Unable to add window -- token null is not valid
- 编辑距离算法(LD)详解
- JavaEE基础之冒泡排序
- Android性能优化的几个方面
- 远程连接Linux的相关配置
- 作者: 果冻虾仁 来源: CSDN 发布时间: 2017-08-10 23:08 阅读: 52608 次 推荐: 251
- masonry报'attempting to add unsupported attribute: (null)'
- 类似angularjs的ng-options解析规则的解析函数
- 为什么说 Objective-C 是一种动态语言?
- hdu1085Holding Bin-Laden Captive!组合问题
- Python35调用谷歌翻译
- 2017 ACM Arabella Collegiate Programming Contest F. Monkeying Around GYM101350F
- 第五周项目一——j建立顺序栈算法库
- 用命令行工具sqlite3打开数据库出现乱码的解决方案
- 导入excel 到sqlserver数据库 外部数据库驱动程序中(1)的意外错误 [问题点数:40分]