重写UICollectionViewFlowLayout报cache mismatched frame警告
在重写UICollectionViewFlowLayout的时候会有很多坑,比如:
Logging only once for UICollectionViewFlowLayout cache mismatched frame
UICollectionViewFlowLayout has cached frame mismatch for index path <NSIndexPath: 0xc000000000200016> {length = 2, path = 0 - 1} - cached value: {{85, 40}, {55, 30}}; expected value: {{89, 40}, {55, 30}}
This is likely occurring because the flow layout subclass RHCollectionViewFlowLayout is modifying attributes returned by UICollectionViewFlowLayout without copying them
这个警告的大致原因是:返回的数组时,没有使用该数组的拷贝对象,而是直接使用了该数组。找了一圈资料,大部分是说需要进行深拷贝。
emmm...该方案是可行的,只是大部分找错了地方。
stackoverflow解决方案中找到了匹配的解决方法:
在- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath
方法中
将:UICollectionViewLayoutAttributes * currentItemAttributes = [super layoutAttributesForItemAtIndexPath:indexPath];
改成:UICollectionViewLayoutAttributes * currentItemAttributes = [[super layoutAttributesForItemAtIndexPath:indexPath] copy];
stackoverflow解决方式
具体GitHub解决案例
重写UICollectionViewFlowLayout报cache mismatched frame警告的更多相关文章
- WaterfallFlowLayout瀑布流用重写UICollectionViewFlowLayout类实现
最近调研瀑布流,在gitHub上下了个Demo发现它的所有视图都是用Main.storyboard拖的, 自己研究半天没研究明白; 然后就又找了一个Demo, 它的视图全是手打的, 但是实现的方法不太 ...
- webpack4.0报WARNING in configuration警告
在进行webpack打包工作时,先进行如下步骤 1). 安装webpack:推荐全局命令 cnpm install webpack -g 查看webpack版本 webpack -v 2) . 此时 ...
- 【hive】在alter修改元数据的时候报错 mismatched input 'xxxxx' expecting KW_EXCHANGE
目的:修改表某个字段属性 语句: 报错信息 错误原因: 在HiveQL中,alter命令不使用与create或select相同的语义 ; 具体来说,您不能使用“ALTER DATABASE.TABLE ...
- vue cli搭建的vue项目 不小心开了eslint 一直报黄色的警告
报错必须处理,警告也忍不了,发现在bulid -webpack.base.config.js 里找到 const createLintingRule = () => ({ /*test: /\. ...
- 【转载】row cache lock
转自:http://blog.itpub.net/26736162/viewspace-2139754/ 定位的办法: --查询row cache lock等待 select event,p1 ...
- php报错: PHP Warning: PHP Startup: memcache: Unable to initialize module
在mac上通过brew 安装php的memcache扩展(brew install php56-memcache)后运行 ~ php -mPHP Warning: PHP Startup: mem ...
- C#中在比较自定义对象的时候要重写Equals方法
using System;using System.Collections.Generic;using System.Text; namespace Equal{ using System; c ...
- C# 重写Equals
public class PerformanceRank { public int Rank { get; set; } public string Eid { get; set; } public ...
- 取消 Vue 中格式编译警告
使用VS Code在学习 Vue 的过程中,博主是在2.0之后开始学习的,在写项目的时候发现控制台经常会报一大堆的警告,都是关于格式的,有时候少空格,有时候多空格,不胜其烦,出现这个问题是因为在初始化 ...
随机推荐
- elasticsearch集群搭建报错: not enough master nodes discovered during pinging
自己用一台 阿里云 服务器 搭建ES集群的时候,总是报上面的问题. 而且两个ES服务都是报同样的问题.自己的配置文件如下: es服务1配置文件 cluster.name: elasticsearch ...
- android去应用市场升级
private String getAppInfo() { try { String pkName = this.getPackageName(); String versionName ...
- windows 下 gdb 的安装
在 windows 下 gcc/g++ 的安装 这篇文章中已经提到,用MinGW Installation Manager可以方便地管理 MinGW 组件,因此使用该软件安装 gdb . 打开 Min ...
- Python初学者第十六天 文件处理操作练习
16day 练习:模拟登陆 1.用户输入账号密码进行登陆: 2.用户信息保存在文件内: 3.用户密码输入错误三次后,锁定用户,下次登陆,检测到这个用户再也登陆不了 #获取用户名及密码f_user = ...
- July 30th 2017 Week 31st Sunday
Eternity is not a distance, but a decision. 永恒不是一段距离,而是一种决定. What can be called as eternity? Wealth ...
- msysgit 上传文件夹,规范化的日常
在我们第一次成功的上传到github之后,要上传文件夹的我们要在msysgit里输入些什么呢? 选择要上传的文件夹前一项右键点击git bash here 进入msysgit后 首先初始化,输入 gi ...
- javascript对象和函数的几种常见写法
/** * Created by chet on 15/12/17. */ var En= function (button,func) { //dosth,不能return alert(button ...
- [POI2015]LOG
题目 发现询问是针对整个区间,也就是说位置什么用都没有 发现我们需要构造出\(s\)个长度为\(c\)的数列,每个数只能在一个数列中出现一次,且一个数最多的使用次数是其大小 对于那些大于等于\(s\) ...
- programming-languages学习笔记--第6部分
programming-languages学习笔记–第6部分 */--> pre.src {background-color: #292b2e; color: #b2b2b2;} program ...
- [19/04/22-星期一] GOF23_创建型模式(单例模式)
一.概念 <Design Patterns: Elements of Reusable Object-Oriented Software>(即后述<设计模式>一书),由 Eri ...