ios - CollectionView nil -



ios - CollectionView nil -

i'm trying update value 1 of cells. however, first time function, cellforitematindexpath, called, viewwithtag returns nil. value still changes, though.

/// llena el contenido de las celdas de la vista func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell { var cell = uicollectionviewcell() switch collectionview.tag { // primer condicion para llenar las celdas de productos estrella case 1: cell = collectionview.dequeuereusablecellwithreuseidentifier("cellestrella", forindexpath: indexpath) uicollectionviewcell if var image = cell.viewwithtag(1) as? uiimageview { image.image = wsmanagerimages().selectimageatindex2("1", intable: tablas.galeriaproductos) image.clipstobounds = true } homecoming cell // segunda condicion para llenar las celdas de productos case 2: cell = collectionview.dequeuereusablecellwithreuseidentifier("cellproductogeneral", forindexpath: indexpath) uicollectionviewcell if var image = cell.viewwithtag(1) as? uiimageview{ image.image = wsmanagerimages().selectimageatindex("\(indexpath.row+2)", intable: tablas.galeriaproductos) image.clipstobounds = true } if productosseleccionados["\(indexpath.section)-"+"\(indexpath.row)"] != nil { cell.layer.bordercolor = uicolor.blackcolor().cgcolor cell.layer.borderwidth = 2.0 cell.layer.cornerradius = 2.0 } else { cell.layer.bordercolor = uicolor.clearcolor().cgcolor cell.layer.borderwidth = 0 } homecoming cell default: homecoming cell } }

ios swift uicollectionviewlayout

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -