Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何将序列ios5序列图像板uitableview中的数据传递到详细信息视图_Iphone_Uitableview_Ios5 - Fatal编程技术网

Iphone 如何将序列ios5序列图像板uitableview中的数据传递到详细信息视图

Iphone 如何将序列ios5序列图像板uitableview中的数据传递到详细信息视图,iphone,uitableview,ios5,Iphone,Uitableview,Ios5,我正在ios5中使用故事板创建一个应用程序。我在导航控制器中嵌入了一个tableviewcontroller,当您单击tableviewcontroller中的单元格时,有关该单元格主题的一些详细信息应传递给详细视图。我使用plist填充tableview和detail视图。我在没有使用故事板的情况下做得很好,但我想学习如何使用故事板。我必须从tableviewcontroller转到我的详细视图 我的顺序代码是: - (void)prepareForSegue:(UIStoryboardSeg

我正在ios5中使用故事板创建一个应用程序。我在导航控制器中嵌入了一个tableviewcontroller,当您单击tableviewcontroller中的单元格时,有关该单元格主题的一些详细信息应传递给详细视图。我使用plist填充tableview和detail视图。我在没有使用故事板的情况下做得很好,但我想学习如何使用故事板。我必须从tableviewcontroller转到我的详细视图

我的顺序代码是:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"DetailViewControllerSeque"])
    {   DetailViewController *detailViewController = [segue destinationViewController];  
        NSString *path = [[NSBundle mainBundle] bundlePath];
        NSString *finalPath = [path stringByAppendingPathComponent:@"questList.plist"];
        NSArray *tempArray = [finalPath valueForKey:@"description"];
        NSString *descriptionString = [tempArray valueForKey:@"description"];
        detailViewController.detailDescriptionText.text = descriptionString;    
    }
}

谢谢你的帮助。

我也遇到了同样的问题,但还没有用故事板解决它。但是,我认为segue应该从单元格开始,而不是从整个tableviewcontroller开始。如果您使用原型单元,这可能会起作用,但我不知道代码创建的单元类型。如果您能在这个话题上提供帮助,我也将不胜感激

编辑:
上的教程建议不存在segue解决方案,您仍然需要在代码中转换到详细视图。我不知道这有多正确,但我会一直这样做,直到有人向我展示纯故事板/segue解决方案;)

我也遇到了同样的问题,遵循Ray Wenderlich教程的部分内容,发现需要选择表格单元格并按住Ctrl键拖动到viewcontroller。然后在
didselectrowatinexpath
中调用
performsguewithidentifier

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
     [self performSegueWithIdentifier:@"mySegueId" sender:self];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{   
        NSLog(@"prepareForSegue: %@", segue.identifier  );      
        if ([segue.identifier isEqualToString:@"mySegueId"])
        {
            DetailController *detailController = segue.destinationViewController;
            detailController.delegate = (id)self;
            detailController.selected = selectedRow;
        }   
}

我也有同样的问题(因为缺乏使用iOS5的经验)

事实证明,这是一个带有iOS5 SDK的示例应用程序,它有一个表视图,当点击一个表单元格时使用segues:“简单向下钻取”

在表格单元格中设置segue,并在情节提要文件中为其命名

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    /*
     When a row is selected, the segue creates the detail view controller as the destination.
     Set the detail view controller's detail item to the item associated with the selected row.
     */
    if ([[segue identifier] isEqualToString:@"ShowSelectedPlay"]) {

        NSIndexPath *selectedRowIndex = [self.tableView indexPathForSelectedRow];
        DetailViewController *detailViewController = [segue destinationViewController];
        detailViewController.play = [dataController objectInListAtIndex:selectedRowIndex.row];
    }
}
不需要电话:
[self-PerformsgueWithIdentifier:@“mySegueId”发件人:self]

您可以使用
nsindepath*selectedRowIndex=[self.tableView indexPathForSelectedRow]
要获取所选信息,请在
-(void)prepareforsgue:(UIStoryboardSegue*)segue sender:(id)sender{…}
函数中。请尝试这种方法

首先命名您的segue(从tableview单元格到detail视图),然后


别忘了导入第二个ViewController/DetailViewController

谢谢您多次光临。我已经被这个问题困扰了好几个小时。谢谢
dataController
从何而来?如果你理解了这个问题,数据是用segue方法处理的:-(void)prepareforsgue:(UIStoryboardSegue*)segue sender:(id)senderthanks,这正是我想要的!这里有一个错误detailControllerController,不允许我编辑或我自己修复。这两个答案对我都有帮助,但我很惊讶我也需要这个答案。我以为苹果会这样做,这样就足以将细胞与下一个场景连接起来,而不必告诉该执行哪个segue。。。。不管怎样,它是有效的。
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{


    if([segue.identifier isEqualToString:@"yourSegueName"]){

        DetailViewController * detailViewController =segue.destinationViewController;
        detailViewController =[self.yourTableViewDataArray objectAtIndex:[self.yourTableView indexPathForSelectedRow].row];

    }

}