如何将序列 ios5 故事板 uitableview 中的数据传递到

How pass data in seque ios5 storyboard uitableview to detail view(如何将序列 ios5 故事板 uitableview 中的数据传递到详细视图)
本文介绍了如何将序列 ios5 故事板 uitableview 中的数据传递到详细视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm creating an app in ios5 using storyboards. I have a tableviewcontroller embedded in a navigation controller and when you click on the cells in the tableviewcontroller some detail about that cell topic should be passed to a detail view. I use a plist to populate the tableview and the detail view. I've done this fine without using storyboard but want to learn how to use storyboard. I have seque going to my detail view from the 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;    
    }
}

感谢您的帮助.

推荐答案

我遇到了同样的问题(由于缺乏 iOS5 经验).

I was having the same problem (from lack of experience with iOS5).

事实证明,这是一个带有 iOS5 SDK 的示例应用程序,它有一个表格视图,当点击表格单元格时使用 segues:Simple Drill Down".

It turns out that is an example app with the iOS5 SDK which has a table view that uses segues when a table cell is tapped : "Simple Drill Down".

https://web.archive.org/web/20130513140140/http://developer.apple.com:80/library/ios/#samplecode/SimpleDrillDown/Introduction/Intro.html

您确实在表格单元格处设置了转场,并在情节提要文件中为其命名.

You do set the segue at the table cell and give it a name in the storyboard file.

- (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];
    }
}

这篇关于如何将序列 ios5 故事板 uitableview 中的数据传递到详细视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type(异常:不应为错误类型创建SimpleTypeImpl)
Android IllegalArgumentException: The tag for fragment_XXX is invalid. Received: layout-sw600dp/fragment_XXX_0(Android IlLegalArgumentException:Fragment_XXX的标签无效。收到:Layout-sw600dp/Fragment_XXX_0)
iOS convert audio sample rate from 16 kHz to 8 kHz(IOS将音频采样率从16 kHz转换为8 kHz)
Enforcing an audio sampling rate in iOS(在iOS中强制音频采样率)
HTTPS request using volley(使用 volley 的 HTTPS 请求)