Iphone 以UIView作为子视图创建的表格单元格未在iOS7中显示

Iphone 以UIView作为子视图创建的表格单元格未在iOS7中显示,iphone,objective-c,uitableview,ios7,uiview,Iphone,Objective C,Uitableview,Ios7,Uiview,我已经在UITable单元格的顶部创建了UIView,但它没有显示在iOS7中,而iOS6中工作正常。请给我提供解决方案 我们正在表格的末尾添加“更多”按钮 添加了相同的代码: UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 768, 40)]; footerView.backgroundColor = [UIColor grayColor]; UIButton *btnLoadMore = [UIButto

我已经在UITable单元格的顶部创建了UIView,但它没有显示在iOS7中,而iOS6中工作正常。请给我提供解决方案

我们正在表格的末尾添加“更多”按钮

添加了相同的代码:

UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 768, 40)];
footerView.backgroundColor  = [UIColor grayColor];
UIButton *btnLoadMore = [UIButton buttonWithType:UIButtonTypeCustom];
btnLoadMore.frame = CGRectMake(-10, 0, 768, 30);
btnLoadMore.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleWidth;
[btnLoadMore setTitle:@"Sample" forState:UIControlStateNormal];
[btnLoadMore setBackgroundColor:[UIColor redColor]];
[btnLoadMore setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[btnLoadMore addTarget:self action:@selector(loadMore) forControlEvents:UIControlEventTouchUpInside];
btnLoadMore.userInteractionEnabled=YES;
[btnLoadMore.titleLabel setFont:[UIFont fontWithName:@"Helvetica" size:17.0]];
[footerView addSubview:btnLoadMore];
 [footerView setHidden:YES];
[footerView setTag:999];
[cell addSubview: footerView];
for (id subView in [cell subviews]) {
        [subView setHidden:NO];
       }
    UIView *lastRow = [cell viewWithTag:999];
    [lastRow setHidden:YES];

    if(indexPath.section == [arSearch count] && isLoadMore){
        for (id subView in [cell subviews]) {
            [subView setHidden:YES];
        }
        cell.backgroundView = nil;
        [lastRow setHidden:NO];

检查你的代码。为什么你写了下面这行:

     [footerView setHidden:YES];
我想你是在对单元格隐藏视图。

而不是

[cell addSubview: footerView];
使用

也删除

[footerView setHidden:YES];
对于loadmore,我总是在下面做

UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 65)];
v.backgroundColor = [UIColor clearColor];

    int mySiz = 0;
    // keep counter how many times load more is pressed.. initial is 0 (this is like index)
    mySiz = [startNumberLabel.text intValue]+1;

    // i have 15 bcz my index size is 15.
if ([feeds count]>=(15*mySiz)) {
    NSLog(@"showing button...");
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(10, 10, 296, 45)];
    [button setBackgroundImage:[UIImage imageNamed:localize(@"loadmore")] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(loadMoreData:) forControlEvents:UIControlEventTouchUpInside];
    [v addSubview:button];
    mainTableView.tableFooterView = v;
} else {
    mainTableView.tableFooterView = nil;
}
}

[mainTableView reloadData];

但我已经根据逻辑为页脚视图提供了隐藏no,并且它正在工作iOS6@Warrior检查显示的代码并从中删除此行:[footerView setHidden:YES]@我查过你的密码了。我不明白你为什么隐藏视图&而不是根据条件显示它。但至少尝试一次,去掉这条线。
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 65)];
v.backgroundColor = [UIColor clearColor];

    int mySiz = 0;
    // keep counter how many times load more is pressed.. initial is 0 (this is like index)
    mySiz = [startNumberLabel.text intValue]+1;

    // i have 15 bcz my index size is 15.
if ([feeds count]>=(15*mySiz)) {
    NSLog(@"showing button...");
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(10, 10, 296, 45)];
    [button setBackgroundImage:[UIImage imageNamed:localize(@"loadmore")] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(loadMoreData:) forControlEvents:UIControlEventTouchUpInside];
    [v addSubview:button];
    mainTableView.tableFooterView = v;
} else {
    mainTableView.tableFooterView = nil;
}
}

[mainTableView reloadData];