我正在尝试将我在Table View Controller上的代码更改为Collection View Controller,现在我正试图让Segue工作,但是我收到了这个错误:
'UICollectionView'没有可见的@interface声明选择器'indexPathForSelectedRow'
这是我的Segue:
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ( [segue.identifier isEqualToString:@"showUpcomingRelease"]){
UpcomingReleaseViewController *upcomingReleaseViewController = (UpcomingReleaseViewController *)[segue destinationViewController];
upcomingReleaseViewController.singleRelease = [self.upcomingReleases objectAtIndex:[[self.collectionView indexPathForSelectedRow] row]];
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showUpcomingRelease"])
{
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] objectAtIndex:0];
UpcomingReleaseViewController *upcomingReleaseViewController = [segue destinationViewController];
upcomingReleaseViewController.singleRelease = self.upcomingReleases[selectedIndexPath.row];
}
}
Run Code Online (Sandbox Code Playgroud)