iphone - 如何从 uitableviewcell 选择中设置 subview 的标题

标签 iphone ios uitableview

我有一个导航应用程序,其中有一个部分可以定义搜索参数,该部分基本上是执行不同操作的自定义单元格的 uitableview(uitextview、开关和标签)

我想要做的是,当用户从 tableview 中选择一个单元格时,它会打开一个新的 uitableview,当该 View 打开时,它将通过 php 向我的数据库发送请求,并获取一个 xml 响应,该响应将填充表那个观点。但是,我只想在上一个 View 中使用一个 uitableview 来选择几个不同的单元格。我想知道当选择父 View 单元格时是否能够指定 subview 的标题。

我希望这能解释我想要实现的目标...如果这不是做事的方式,你可以让我知道..但从我一直在做的事情来看,我认为这是正确的做事方式。

**更新 我现在正在尝试弄清楚如何根据按下的单元格来定义标题,我正在尝试做这样的事情..

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Navigation logic may go here. Create and push another view controller.

     SearchResponseTableViewController *searchResponseTableViewController = [[SearchResponseTableViewController alloc] initWithNibName:@"SearchResponseTableViewController" bundle:nil];
     // ...
     // Pass the selected object to the new view controller.
     [self.navigationController pushViewController:searchResponseTableViewController animated:YES];
    if (indexPath = 1,3) { //<<--- not sure what to do here or if its possible
        searchResponseTableViewController.title = @"manufacture";
    }
     [searchResponseTableViewController release];

}

最佳答案

简单:在 didSelectRowAtIndexPath: 中推送 View 之前,您指定标题,它是 View Controller 的一个属性。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   //...
   SubViewController *controller = [[SubViewController alloc] init]; 
   controller.title = @"Whatever";
   [self.navigationController pushViewController:controller animated:YES];
}

关于iphone - 如何从 uitableviewcell 选择中设置 subview 的标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7237018/

相关文章:

iphone - 命令/usr/bin/codesign 失败,退出代码为 1

ios - UIDocumentInteractionController 和来自网络的文件

ios - Swift - IBAction vs Delegate vs addTarget

ios - Swift - 使用电子邮件的 Google Firebase 身份验证

ios - 将单元格插入已静态创建的表格的一部分

iphone - 如何防止 reloadRowsAtIndexPaths 阻止用户输入?

ios - iOS UITableView如何在NavigationBar下使用?

iphone - 表格 View 崩溃

iphone - 获取节点 :withName: method of soap is called more than 2 million times when parsing some big xml web service

iphone - 背景图像不会扩展到 TableView 单元格中的附件 View 背景