gpt4 book ai didi

iphone - 如何使用 Storyboard从 Masterview 推送到详细 View ?

转载 作者:行者123 更新时间:2023-11-28 22:55:38 25 4
gpt4 key购买 nike

我试图在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com