ios - collectionView cells overlapping -


i trying create multiple collectionviewcells 4 different types. , every cell has different view of 1 of 4 types. every view of types can have different contents based on user selection.

the problem having fact of cards overlapping/not loading correctly when multiple views/cells of same type on screen.

-(uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath {     card *card = [[[usermanager getselecteduser] getcards] objectatindex:indexpath.item];     nslog(@"card loading: %@", card.title);     [card setuplayout];     uicollectionviewcell *cell;     if(card.type.intvalue == 1){         cell = [collectionview dequeuereusablecellwithreuseidentifier:@"lifestylecell" forindexpath:indexpath];     }else if(card.type.intvalue == 2){         cell= [collectionview dequeuereusablecellwithreuseidentifier:@"scenecell" forindexpath:indexpath];     }else if(card.type.intvalue == 3){         cell = [collectionview dequeuereusablecellwithreuseidentifier:@"energycell" forindexpath:indexpath];     }else if(card.type.intvalue == 4){         cell = [collectionview dequeuereusablecellwithreuseidentifier:@"productcell" forindexpath:indexpath];     }else{         cell = [collectionview dequeuereusablecellwithreuseidentifier:@"cardcell" forindexpath:indexpath];     }     [cell addsubview:card];      //add dropshadow     cell.contentview.layer.borderwidth = 1.0f;     cell.contentview.layer.bordercolor = [uicolor clearcolor].cgcolor;     cell.contentview.layer.maskstobounds = yes;      cell.layer.shadowcolor = [uicolor blackcolor].cgcolor;     cell.layer.shadowoffset = cgsizemake(0, 5.0f);     cell.layer.shadowradius = 2.0f;     cell.layer.shadowopacity = 0.5f;     cell.layer.maskstobounds = no;      return cell; } 

the card view add cell. mentioned above there multiple types of cards.

try using:

cell.clipstobounds = yes; 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -