ios - UICollectionView Cells not shown if UITabBarController is on second tab Swift -


i have weird issue uicollectionview , uitabbarcontroller. inside uitabbarcontroller have references 2 different viewcontrollers. if put view controller has uicollectionview first page of uitabbarcontroller list cells (uicollectionview) loading this:

normal loading

but if put second view controller when open tab uiimageview , uilabel disappearing cells: loading on second tab

i have checked collectionview method getting cells , there data printed label , image. here code of methods datasource , delagate

   // tell collection view how many cells make func collectionview(collectionview: uicollectionview, numberofitemsinsection section: int) -> int {     return self.items.count }  // make cell each cell index path func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell {      // reference our storyboard cell     let cell = collectionview.dequeuereusablecellwithreuseidentifier(reuseidentifier, forindexpath: indexpath) as! adscollectionviewcell      // use outlet in our custom class reference uilabel in cell     cell.mylabel.text = self.items[indexpath.item]     cell.backgroundcolor = uicolor.whitecolor() // make cell more visible in our     cell.layer.bordercolor = uicolor.graycolor().cgcolor     cell.layer.borderwidth = 1     cell.layer.cornerradius = 8     cell.layoutifneeded()     return cell }  func collectionview(collectionview: uicollectionview, layout collectionviewlayout: uicollectionviewlayout, sizeforitematindexpath indexpath: nsindexpath) -> cgsize {     let width = collectionview.frame.width - 22;     return cgsize(width: width/2, height: width/2); }  // mark: - uicollectionviewdelegate protocol  func collectionview(collectionview: uicollectionview, didselectitematindexpath indexpath: nsindexpath) {     // handle tap events     print("you selected cell #\(indexpath.item)!") } 

is there had problem this? how can solved?


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -