Tag: 多表

iOS程序在单个UIViewController中使用多个UITableView

我正在尝试在故事板中的一个segue中实现3个表格。 当select一个表时,它将取消隐藏另一个表的视图,同样也有一个表。 下面的代码我用于一个表格的每个单元格的格式是不同的,行也有所不同。 那么如何通过编码来为每个表格区分不同的行数呢? -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 3; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell2"; UITableViewCell *cell1 = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell1==nil) { cell1=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } temp=[array objectAtIndex:indexPath.row]; UILabel *Label1 = (UILabel *)[cell1 viewWithTag:4]; Label1.text = temp.Title; UILabel *Label2 […]