我引用以下法典,该法典应在顶部/顶部树立形象,然后在他人中形成文字。 我认为,问题是试图在囚室偏离屏幕时重新使用该囚室的代码,但可以确定我应该改变的内容。 你可以在此看到有关问题的录像:
http://crcast.com/t/OoQWMI5zCKVc”rel=“nofollow”http://crcast.com/t/OoQWMI5zCKVc
该法典如下:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifierText = @"TextCell";
static NSString *CellIdentifierImage = @"ImageCell";
if (indexPath.section == 0)
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierImage];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifierImage] autorelease];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,180)];
imageView.tag = 1;
imageView.image = [UIImage imageNamed:@"prem.jpg"];
[cell addSubview:imageView];
[imageView release];
}
return cell;
}
else {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierText];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifierImage] autorelease];
}
if(indexPath.section == 1)
cell.textLabel.text = [arryTableData objectAtIndex:indexPath.row];
else if(indexPath.section ==2)
cell.textLabel.text = [arryAddressInfo objectAtIndex:indexPath.row];
else if(indexPath.section == 3)
cell.textLabel.text = [arryTableActions objectAtIndex:indexPath.row];
else if(indexPath.section == 4)
cell.textLabel.text = @"REPLACE ME WITH ICONS";
return cell;
}
}