Skip to content

madordie/Demo-CHT-166BUG

Repository files navigation

DEMO-CHT # 166BUG

Reproduce the BUG described in #174.

The demo will have a part of the header does not display properly.

The main steps

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";

DEMO-CHT#166BUG

重现#174中所描述的BUG。

这个demo将有一部分header无法正常显示.

主要步骤

UICollectionViewWaterfallLayout.m -> - (void)prepareLayout 中,设置headerfooter使用的NSIndexPath定义均为[NSIndexPath indexPathForItem:0 inSection:section]

UICollectionViewWaterfallLayout.m -> - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect中,采用了NSDictionary作为存储结构,使用attrNSIndexPath作为NSDictionary的key

所以,当UICollectionViewWaterfallLayout.m -> - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect需要同时返回headerfooter将会出现headerfooter替换的现象。即:dict中的value1将被value2所替换。

NSMutableDictionary *dict = [NSMutableDictionary dictionary];
dict[@"KEY"] = @"value1";
dict[@"KEY"] = @"value2";

About

重现CHT#166BUG

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published