我有两个表在同一个类,我需要每个表包含不同的数据,但我有麻烦的委托...如何使每个表包含一个单独的委托?谢谢,我的英语很抱歉。 。两个UITableView在同一个类中?数据源和委托
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1; }
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [dataTable1 count];
}
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
CeldaFamilia *cell = (CeldaFamilia *)[aTableView dequeueReusableCellWithIdentifier:@"CeldaFamilia"];
if (!cell) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CeldaFamilia" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.propTextFamilia.text =[dataTable1 objectAtIndex:indexPath.row];
return cell;
}
为什么这些方法有参数'tableView'有一个特殊的原因。主要原因是你可以做'如果[tableView isEqual:tv1] ...'。 –