ios - why does the dynamic collection cells in collection view doesnt display as given size and changes after scrolling in swift 3 -
i have collection view.i need display cells varying width @ sequences. first 4 cells displayed required after consecutive 5th image disappears , others displayed not in desired manner. doesnot show in simulator. view gets distorted when scrolling collection view.please me out in swift 3.
if want resize uicollectionviewcell try implement method, setting frame inside cellforrowat wrong.
func collectionview(_ collectionview: uicollectionview!, layout _: uicollectionviewlayout!, sizeforitematindexpath indexpath: indexpath!) -> cgsize { if indexpath.row%3 == 0 { return cgsize(width: 172, height: 120) } else { ..... }//switch, if, whatever }
Comments
Post a Comment