【问题标题】:TableView to detailview : Display Image and description in DetailView iphone sdkTableView 到 detailview:在 DetailView iphone sdk 中显示图像和描述
【发布时间】:2012-09-22 16:13:08
【问题描述】:

我解释我的问题。 我有我的 RootController 和我的 DetailController。 我想做一堂烹饪课。 在我的根控制器上,就是这样:http://www.noelshack.com/2012-38-1348330181-rootview.png I'd like when a row is selected my detailcontroller is like this : http://www.noelshack.com/2012-38-1348330163-detailview.png

因此,描述和图像更改取决于所选行。 怎么会这样?

谢谢。

【问题讨论】:

    标签: iphone sdk uiviewcontroller imageview tableview


    【解决方案1】:

    大概,您的烹饪课程由应用程序架构中的某个模型对象表示。在这种情况下,您的详细视图控制器需要具有一个属性,该属性引用您的RootController 中表格视图的行所表示的模型对象的实例。当您实例化详细视图控制器时,RootController 将向DetailController 提供模型对象的实例(我们称之为Recipe),例如

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        CookLesson *lesson = [lessons objectAtIndex:indexPath.row];
        DetailController *detailController = [[DetailController alloc] initWithNibName:"your-nib-name" bundle:nil];
        detailController.lesson = lesson;
        // push the controller on the nav stack, etc.
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-07
      • 2015-11-08
      • 2014-11-27
      • 2016-03-23
      • 2023-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多