ios - why attributes properties in layoutAttributesForItemAtIndexPath does not get applied? -
if modified attribute property in layoutattributesforitematindexpath collectionview cell not modified
-(uicollectionviewlayoutattributes *)layoutattributesforitematindexpath:(nsindexpath *)indexpath { uicollectionviewlayoutattributes *attributes = [super layoutattributesforitematindexpath:indexpath];
//this properties not applied attributes.zindex = 1; attributes.alpha = 0.5; return attributes; }
but when moving properties modifications layoutattributesforelementsinrect gets applied:
-(nsarray *)layoutattributesforelementsinrect:(cgrect)rect { nsarray *attributesarray = [super layoutattributesforelementsinrect:rect];
for (uicollectionviewlayoutattributes *attributes in attributesarray) { //this properties getting applied here attributes.zindex = 1; attributes.alpha = 0.5; } return attributesarray; }
i'am applying uipangesturerecognizer on uicollectionview , want apply these properties on cell i'am dragging .
i'am apple call layoutattributesforitematindexpath method while i'am dragging through calling method
[customlayoutinstance indexofitemselected:indexpath.row]; layoutattributesforitematindexpath called long i'am dragging properties not applied.
you should override 1 more method:
- (nsarray *)layoutattributesforelementsinrect:(cgrect)rect { {
Comments
Post a Comment