Reproduce the BUG described in #174.
The demo
will have a part of the header
does not display properly.
In the UICollectionViewWaterfallLayout.m -> - (void) prepareLayout
, set
NSIndexPath indexPathForItem: 0 inSection: section]`
In the UICollectionViewWaterfallLayout.m -> - (NSArray *) layoutAttributesForElementsInRect: (CGRect) rect
, using the NSDictionary
as the storage structure, use attr`` NSIndexPath
as the NSDictionary
key
So, when UICollectionViewWaterfallLayout.m -> - (NSArray *) layoutAttributesForElementsInRect: (CGRect) rect
need to return both header
and footer
'will appear. That is, value1
in dict
will be replaced by value2
.
NSMutableDictionary * dict = [NSMutableDictionary dictionary];
Dict [@ "KEY"] = @ "value1";
Dict [@ "KEY"] = @ "value2";
重现#174中所描述的BUG。
这个demo
将有一部分header
无法正常显示.
在 UICollectionViewWaterfallLayout.m -> - (void)prepareLayout
中,设置header
、footer
使用的NSIndexPath
定义均为[NSIndexPath indexPathForItem:0 inSection:section]
在 UICollectionViewWaterfallLayout.m -> - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
中,采用了NSDictionary
作为存储结构,使用attr
的NSIndexPath
作为NSDictionary
的key
所以,当UICollectionViewWaterfallLayout.m -> - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
需要同时返回header
和footer
将会出现header
被footer
替换的现象。即:dict
中的value1
将被value2
所替换。
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
dict[@"KEY"] = @"value1";
dict[@"KEY"] = @"value2";