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

标签 iphone ios xcode uistoryboard

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

相关文章:

iphone - UIActivityViewController 附加文​​件 - 错误的文件类型

iphone - 是否可以将多个纹理映射到 openGL ES 中的一个形状上?

iphone - 使用条件 Storyboard进行转场

iphone - ios设备的发布和删除方法

ios - 仅当当前字体大小不适合时才更改标签字体大小

ios - 我如何通过快速编程测试是否只有一种方法在 xcode 中有效?

iphone - 可以在我的框架中包含其他框架或库吗?

ios - 如何将 Realm 对象类添加到 RLMArray

ios - 确定基于网格的游戏中可能的移动/路径

xcode - 从一个 View Controller 导航到另一个 View Controller