So the problem I'm having is that I have a CollectionView
that loads different data depending on the index
. If, for example, I'm at index 0
and the first cell
is "hat" and I switch to index 1
and the first cell
is "coat". The problem is if I click on the "coat" and then click the Back button
... it shows the coat but we're really still on "hat". And if you click on the "coat" it will bring up the details for the "hat".
I solved a similar problem before by just reloading the CollectionView
upon pressing the back button
... but that doesn't seem to be working this time. So what I want to do is make sure the segmented control index
is set to 0
before the reload.
Here's what I have so far from the Hat/Coat detailview
:
UserViewController *userVC = [[UserViewController alloc] init];
[userVC.collectionView reloadData];
And here's the code for the segmented control
in the UserViewController
:
HMSegmentedControl * segmentedControl = [[HMSegmentedControl alloc] initWithFrame:CGRectMake(0, 280, 600, 50)];
[segmentedControl setSelectedSegmentIndex:0];
I can't quite figure out the code to change that index from the detail view
. Or, if that wouldn't work, to just get it to reload the whole view.