ios - 仅在 iPhone5s 和更高版本中覆盖 TableView 部分

标签 ios objective-c uitableview

enter image description here我正在使用包含两个部分的分组表,但它仅在 iPhone 5s 及更高版本中被覆盖。它在 4s 和 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];
    }
}

这里是5秒截图输出

最佳答案

您需要编写以下代码。

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

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

关于ios - 仅在 iPhone5s 和更高版本中覆盖 TableView 部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26398924/

相关文章:

ios - iOS 应用程序的仪表板中未记录 Flurry 事件

ios - 在 2D 和 3D map View 之间切换 (pitchEnabled)

iphone - 以编程方式将 NavigationBar 添加到 UITableViewController?

iphone - 如何在 UIDatePicker 中指定时区

ios - 有什么方法可以获取我的 TableView 中的数据来计算并保持总计

ios - Titanium : build error after upgrade to 3. 5.0.GA(体系结构 x86_64 的 undefined symbol )

ios - 等价查询 MagicalRecord -> Realm.io

ios - 在下次运行之前以后台模式关闭应用程序

swift - 按下单元格时,自定义表格单元格上的 UIButton 会清除背景

ios - 模仿iOS iTunes商店中的横向和纵向组合滚动