Objective c 如何仅更改tableview中最后一个单元格的行高?

Objective c 如何仅更改tableview中最后一个单元格的行高?,objective-c,Objective C,在我的表格视图中,我有200多行,然后我将loadmoreresults保留在最后一个单元格中,使其每页仅显示40行。当用户单击load more results时,将显示40多个单元格。我将loadmoreresults单元格的行高更改为与其他单元格不同。问题是当没有更多的结果时,其他单元格的高度会受到loadmoreresults单元格高度的影响。我不想将最后一行的高度影响到其他行 我写的代码是: - (NSInteger)tableView:(UITableView *)tableView

在我的表格视图中,我有200多行,然后我将loadmoreresults保留在最后一个单元格中,使其每页仅显示40行。当用户单击load more results时,将显示40多个单元格。我将loadmoreresults单元格的行高更改为与其他单元格不同。问题是当没有更多的结果时,其他单元格的高度会受到loadmoreresults单元格高度的影响。我不想将最后一行的高度影响到其他行

我写的代码是:

- (NSInteger)tableView:(UITableView *)tableView  numberOfRowsInSection:(NSInteger)section
{
ZohoAppDelegate* appDelegate = (ZohoAppDelegate*) [ [UIApplication sharedApplication] delegate];

int maxResults = [appDelegate.invoiceMaxValues intValue];
int noOfResults = [invoiceArray count] ;
if (noOfResults != 0 )
{   
    if (maxResults > noOfResults)
    {
        noOfResults++;
        rowCount = noOfResults;
    }
}
return noOfResults;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row == (rowCount -1))
{
    return 50;
}
return 80;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
if (cell == nil) 
{
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"MasterViewIdentifier"] autorelease];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.accessoryType = UITableViewCellAccessoryNone;
    UIView* elementView =  [[UIView alloc] initWithFrame:CGRectMake(5,5,312,480)];
    elementView.tag = 0;
    [cell.contentView addSubview:elementView];
    [elementView release];
}
UIView* elementView  = [cell.contentView viewWithTag:0];
for(UIView* subView in elementView.subviews)
{
    [subView removeFromSuperview];
}

UIImageView* imaeView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 78)];
if(indexPath.row == (rowCount-1))
{
    elementView.backgroundColor = [UIColor colorWithRed:0.92578125 green:0.92578125 blue:0.92578125 alpha:1];
}
else
{
    imaeView.image=[UIImage imageNamed:@"estimatecellbg.png" ];
}
[elementView addSubview:imaeView];
[imaeView release];
    return cell;
  }
任何人的帮助都将不胜感激

谢谢,,
莫尼什语。

类似于

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(indexPath.row == (rowCount -1) && moreResults)
    {
        return 50;
    }
    return 80;
}