title: Segue to self controller releasing data of previous controller
body: <p>Hi I am developing IOS application. I have one collection view. On click of cell of collection view I am opening same controller with some new data. In this case on first attempt it opening new controller with some new data. But when come back to previous controller and again click on any cell then it gives me error for empty array. That mean it is releasing that data. I tried it in following way:</p>
  
  <pre><code>@property(retain, nonatomic) NSMutableArray *relatedArrayList;
  assign values in .m file 
  on click on cell prepare for segue like this ...
  - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  {
  
  if([[segue identifier] isEqualToString:@"selfDetailSegue"])
  {
      MediaDetailViewController *mediaDetails = [segue destinationViewController];
      NSIndexPath *indexPath = [[_collectionView indexPathsForSelectedItems] lastObject];
          mediaDetails.videoData = [_relatedArrayList objectAtIndex:indexPath.row];
  }
  }
  </code></pre>
  
  <p>first time it is working fine. But when I come and click another cell it gives following error </p>
  
  <pre><code>Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
  </code></pre>
  
  <p>How to retain those values in this scenario? I am doing anything wrong? Need Some help. Thank you.</p>