0

I have a UICollectionView that's connected to myclass datasource and delegate. When I call [self.collectionview reloaddata] it works normally but after a while (random time and number of times) when I reload the collection again it doesn't work any more.

collection reference delegate and datasource are correctly defined.

self.devicesCollectionViewDataSource= devices;

self.devicesCollectionView.delegate = self;

self.devicesCollectionView.dataSource = self;

[self.devicesCollectionView reloadData];
arco444
  • 22,002
  • 12
  • 63
  • 67
user3347073
  • 137
  • 1
  • 5
  • 1
    Add more code please. – gran33 Sep 16 '14 at 12:19
  • 1
    "After awhile" and "random time" is probably very hard for you to debug. Imagine how hard it is for users who don't know what the rest of your code looks like? 1) How do you know they delegate and datasource methods aren't getting called (do you have log statements in them?) 2) Is it possible that under some circumstance your setting the delegate and datasource to something else after it initially works? – Adam Jenkins Sep 16 '14 at 12:19
  • `self.collectionview` in the first paragraph, but `self.devicesCollectionView` in the code. – rintaro Sep 16 '14 at 12:28

1 Answers1

0

Overwrite the setDelegate method of your collection view subclass, set a breakpoint and observe who's changing it.

-(void)setDelegate:(id<YOUR_PROTOCOL>)delegate {
    _delegate = delegate; // breakpoint here -> look at the trace log, it should give you the caller that's overwriting your delegate

}

Clarification: this doesn't solve your problem per se, but at least you know where to look

Alessandro
  • 258
  • 1
  • 3
  • 10