Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.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中一次在一个屏幕上设置多个TableView_Iphone_Xcode_Uitableview - Fatal编程技术网

是否可以在iphone中一次在一个屏幕上设置多个TableView

是否可以在iphone中一次在一个屏幕上设置多个TableView,iphone,xcode,uitableview,Iphone,Xcode,Uitableview,我是iphone的初学者。我需要开发如附件所示的屏幕。所有的值,如机票、飞往纽约的航班、400美元等都来自数据库。在这个屏幕中,机票、出租车/出租车是类型,显示在不同的单元格中。可以使用一个tableview或多个tableview。请给我建议。是的,非常可能。您可以创建任意数量的实例(除非内存不足)。您可以通过使用随附的参数区分delgate方法调用中的TableView来区分它们 像这样看 - (void)tableView:(UITableView *)tableView didSelec

我是iphone的初学者。我需要开发如附件所示的屏幕。所有的值,如机票、飞往纽约的航班、400美元等都来自数据库。在这个屏幕中,机票、出租车/出租车是类型,显示在不同的单元格中。可以使用一个tableview或多个tableview。请给我建议。

是的,非常可能。您可以创建任意数量的实例(除非内存不足)。您可以通过使用随附的参数区分delgate方法调用中的TableView来区分它们

像这样看

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView==tableView1){
//then do something
}else if (tableView==tableView2){
//then do something else.
}
}

希望这有帮助……:)

您不需要创建两个表视图。因为您可以在单个表视图中实现此功能。将一个tableView对象设为

UITableView *tableView;
之后,将区段的数量与您拥有的类别(机票、出租车/出租车)的数量相同,如图所示:-

- (NSInteger)tableView:(UITableView *)tableView numberOfSections:(NSInteger)section  
{     
 return [category count]; 
} 
之后,给他们以下头衔:-

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 
{
if (section == 0)
 {    
 return @"header one";
 } 
}
在此之后,单击特定行执行以下功能:-

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

因此,您可以在单个tableView中实现您的功能。希望有帮助。

谢谢您的回复。但是tableview只能有一个标题部分,但我需要多个标题(标题)。请给我建议。没有人可以给多个标题。每个部分的每个标题都是可能的。:)哦非常感谢你,我会努力的。