相关疑难解决方法(0)

单个视图上的2个tableview

我需要一个示例或解释如何填充在同一视图上的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)

cocoa-touch objective-c uitableview ios

4
推荐指数
1
解决办法
6283
查看次数

标签 统计

cocoa-touch ×1

ios ×1

objective-c ×1

uitableview ×1