我试图在 Storyboard中推送到详细 View ,但没有用。
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"drinkList"])
{
NSIndexPath *myIndexPath = [self.drinksCatTable indexPathForSelectedRow];
if (myIndexPath.row ==0) //if selected is row 1
{
selectedDrinkCat =[segue destinationViewController];
Drinks *drinkList = [aDelegate.categoryArray objectAtIndex:0];//forward all drinks to drinksList
selectedDrinkCat.drinkList = drinkList;//point drinkList to the next view drinkList
selectedDrinkCat.allDrinkStr = @"All";//all drinks selected
NSLog(@"aaa");
}
else
{
Drinks *drinkList = [aDelegate.categoryArray objectAtIndex:(myIndexPath.row)-1];//we have to minus 1 as the row had en extra "All" row which is not in the database
selectedDrinkCat.drinkList = drinkList;
selectedDrinkCat.allDrinkStr =@"cat";
NSLog(@"1111");
}
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self performSegueWithIdentifier:@"drinkList" sender:self];
NSLog(@"called did select");
}
最佳答案
你不应该将 selectedDrinkCat
声明为 destinationViewController
类的 viewcontroller
吗?
类似于:
desmondViewController *selectedDrinkCat=(desmondViewController *)[segue destinationViewController];
关于iphone - 如何使用 Storyboard从 Masterview 推送到详细 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10862843/