TableView 部分仅在 iPhone5s 和更高版本中覆盖 [英] TableView Sections overwrite in iPhone5s and greater versions only

查看:25
本文介绍了TableView 部分仅在 iPhone5s 和更高版本中覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用包含两个部分的分组表,但它仅在 iPhone 5s 和更大.它在 4 秒和 5 秒内运行良好.

I am using Grouped table with two sections but it is overwriting only in iPhone 5s and greater. it is running well in 4s and 5.

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{    
    if (![[self.showingArray objectAtIndex:section]boolValue]) {
        return 1;
    }else{
        return [[self.sectionsArray objectAtIndex:section]count];;
    }
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellIdentifier = @"menuCell";
   // #warning : Use here your custom cell, instead of POPDCell
    POPDCell *cell = nil;
    cell = (POPDCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell) {
        cell=nil;
        [cell removeFromSuperview];
    }
    NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"POPDCell" owner:self options:nil];
    if (cell == nil) {
        cell = [topLevelObjects objectAtIndex:0];
    }
}

这里是 5s 屏幕截图中的输出

Here is output in 5s screen shot

推荐答案

需要编写如下代码.

-(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{

return HEIGHT;
}
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return HEIGHT;
}

这篇关于TableView 部分仅在 iPhone5s 和更高版本中覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆