在您的 FeaturedViewController.m
- (void)viewDidLoad
{
//create reference of your delegate
YourAppDelegate rootApp = (YourAppDelegate *)[[UIApplication sharedApplication]delegate];
double playlistId = [[[[rootApp playlists] items] objectAtIndex:indexPath.row] playlistId ];
[super viewDidLoad];
}
已编辑
或者您可以在 FeaturedViewController 中定义一个属性并在此 VC 中分配值,例如:
FeaturedViewController nextView = [[FeaturedViewController alloc] initWithNibName:@"FeaturedViewController" bundle:nil];
//below lineset the value of property and you can pass value to nextView
nextView.playlistId = [[playlists.items objectAtIndex:indexPath.row] playlistId]; ;
[self.navigationController pushViewController:nextView animated:YES];
希望它能让您了解访问委托的变量