I track along with the iPad application using the storyboard, and I stuck on it for days on end. How can I initiate a popper segue by selecting a cell as a collection? The main problem is to get past the error that the popover should be attached to the view.
The approach seems to place a fictitious popoverAnchorButton(hidden, disconnected) view in the view , creating a transition from it to the popover view in the storyboard, placing it in didSelectItemAtIndexPathand then [self performSegue]. The code is as follows:
- (IBAction)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
[self.collectionView deselectItemAtIndexPath:indexPath animated:NO];
UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath];
CGRect anchorRect = CGRectMake(cell.center.x, cell.center.y, 1.0f, 1.0f);
self.popoverAnchorButton.frame = anchorRect;
[self performSegueWithIdentifier:@"popoverSegue" sender:self];
}
This works elsewhere in the application as a table, since the storyboards allow me to omit the button on the panel to use as the anchor point. But Xcode does not allow me to throw a button or any other suitable view as a collection in a storyboard, so I cannot create a segue. Creating a button programmatically will not help, because I cannot build a UIStoryboardSegue from it, and any manual transition from the controller gives the same error about the missing anchor point. Any ideas?
I think the other way may be to skip segues and program the popover view controller programmatically, but there is an error in this way related to the fact that the popover view I create (since I use storyboards) does not have xib . Do I need to create a separate xib file just for this review? Is this the only option?