Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.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 UITableView详细视图控制器_Iphone_Objective C_Ipad - Fatal编程技术网

Iphone UITableView详细视图控制器

Iphone UITableView详细视图控制器,iphone,objective-c,ipad,Iphone,Objective C,Ipad,我在我的拆分视图应用程序中有表视图,我希望每个表都有不同的视图控制器。例如,一行我有cal,另一行是计算机等,因此对于这两行我可能有不同的视图,单击它们我可能会得到所需的视图 我已经为拆分视图中的表视图编写了以下代码 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { GCRetractableSectionController* sectionCont

我在我的拆分视图应用程序中有表视图,我希望每个表都有不同的视图控制器。例如,一行我有cal,另一行是计算机等,因此对于这两行我可能有不同的视图,单击它们我可能会得到所需的视图

我已经为拆分视图中的表视图编写了以下代码

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section        {
GCRetractableSectionController* sectionController = [self.retractableControllers   objectAtIndex:section];
return sectionController.numberOfRow;
  }

  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   GCRetractableSectionController* sectionController = [self.retractableControllers    objectAtIndex:indexPath.section];
     return [sectionController cellForRow:indexPath.row];
       }

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath  *)indexPath {


     GCRetractableSectionController* sectionController = [self.retractableControllers objectAtIndex:indexPath.section];

        if(indexPath.section == 0){
        if(indexPath.row == 0){
            return [sectionController didSelectCellAtRow:indexPath   viewController:detailViewController withData:@""];
       }
      else {
       return [sectionController didSelectCellAtRow:indexPath viewController:detailViewController withData:[generalCalculatorArray   objectAtIndex:indexPath.row - 1]];
       }
    }
     else if(indexPath.section == 1){
    if(indexPath.row == 0){
    return [sectionController didSelectCellAtRow:indexPath viewController:detailViewController withData:@""];
    }
      else {
       return [sectionController didSelectCellAtRow:indexPath viewController:detailViewController withData:[cardiologyArray objectAtIndex:indexPath.row -  1]];
     }

  }
 }

苹果有你想要的例子,或者你只需要准确地知道 然后继续阅读

NSArray*viewControllers=[[NSArray alloc]initWithObjects:self.navigationController,detailViewController,nil]

其中,上行中的detailViewController表示要更改的详图视图控制器的实例。更改详细视图控制时,有必要更新分割视图控制器的视图控制器阵列

splitViewController.viewControllers=viewControllers

[viewControllers release]



希望这对你有帮助。如果没有,请发表评论。

您的问题是…?按原样运行时会发生什么?它在“详细视图控制器”上显示相同的单元格文本,因此如何为每个单元格提供单独的视图控制器Kory尖锐的问题是,我希望每个单元格都有单独的详细视图,因为每个单元格的数据在详细视图中都有很大的差异可能需要阅读UITableViewController编程指南。似乎您可能对选择单元格时用于显示详细信息内容的机制感到困惑。