我需要一个示例或解释如何填充在同一视图上的2个表视图.我需要了解"cellForRowAtIndexPath"方法,有人可以给我一个关于代码应该如何的例子吗?
我的意思是如何识别哪个表视图?
谢谢
下面是我的cellForRowAtIndexPath方法:
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
// Set up the cell
MyAppAppDelegate *appDelegate = (MyAppAppDelegate *)[[UIApplication sharedApplication] delegate];
if (tableView == radios_tv) { //radio_tv is an IBOutleet UITableView
sqlClass *aRadio = (sqlClass *)[appDelegate.array_radios objectAtIndex:indexPath.row];
[cell setText:aRadio.r_name];
return cell;
}
if …Run Code Online (Sandbox Code Playgroud)