ios - Calling UICollectionView#reloadData in UICollectionViewDelegate#collectionView:didSelectItemAtIndexPath: hides all cells -


i have uiviewcontroller has following implementation didselectitematindexpath

@interface  id section1item nsmutablearray *section2items nsmutablearray *section3items  @end  @implementation  - (void)collectionview:(uicollectionview *)collectionview didselectitematindexpath:(nsindexpath *)indexpath {      if (indexpath.section == 0) {          ;      } else if (indexpath.section == 1) {          self.section1item = [self.section2items objectatindex:indexpath.row];      } else { // indexpath.section == 2          id newsection2item = [self.section3items objectatindex:indexpath.row];          [self.section2items addobject:newsection2item];          [self.section3items removeobject:newsection2item];       }        [collectionview reloaddata];   }   @end 

the idea behind code collectionview has static number of sections, , taping on item in section 3 moves item section 2, , tapping on item in section 2 makes item in section 1.

however once make changes datastructure (section1item, section2items , section3items), , call reloaddata, uicollectionview cells disappear. few symptoms of issue

  1. after reloaddata call, non of datasource methods recalled. tried putting breakpoint in implementation of numberofsectionsincollectionview , collectionview:numberofitemsinsection don't hit.
  2. i tried debugging using revealapp, , found out after reloaddata call, uicollectionviewcell's have hidden property set "yes", though don't have code in code base calling .hidden = yes;
  3. i tried overriding uicollectionviewcell#sethidden detect (if any) part of uikit framework calls it, , again there no breakpoint triggers.

tools details: i'm working xcode5-dp6 on ios7 simulator.

update: uicollectionview shows cells correctly on first render.

ok peeps, able figure out issue. delegate (self) subclass of uiviewcontroller. in init, assigning self.view = viewfromstoryboard viewfromstoryboard passed in caller , setup in storyboard.

since not using of facilities offered subclass uiviewcontroller, decided switch subclassing nsobject , manually retaining pointer uicollectionview.

this fixed problem. i'm not 100% on exact nature of issue. i'm guessing somehow overriding uiviewcontroller's view isn't seems.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -