iphone - 在 iOS 7 中,viewForHeaderInSection 部分是从 1 而不是从 0 开始

标签 iphone ios xcode uitableview ios7

我在我的项目中处理 UITableView 并且这个项目是在 Xcode 4.5 中创建的,现在我正在使用 Xcode 5,所以我的问题是我什么时候会在 iOS 6 中运行我的项目, viewForHeaderInSection 方法部分是从 0 开始的,没关系,但是如果我将使用 iOS 7 运行 viewForHeaderInSection 部分是从 1 而不是 0 开始

问题是UITableView frame 有没有问题

我不明白这是怎么回事

提前致谢

最佳答案

刚遇到一模一样的问题,解决起来很简单。

只需实现这个委托(delegate)方法:

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 20;
}

表格Apple UITableViewDelegate Protocol Reference , 它提到了

Discussion

The returned object can be a UILabel or UIImageView object, as well as a custom view. This method only works correctly when tableView:heightForHeaderInSection: is also implemented.

关于iphone - 在 iOS 7 中,viewForHeaderInSection 部分是从 1 而不是从 0 开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18932476/

相关文章:

c - <png.h> 在 mac os X mavericks 中找不到

iphone - 如何检查两个 ImageView 是否处于同一位置?

iphone - iPhone 5 的默认 568h@2x.png

iphone - 关闭呈现的 View Controller

iphone - 加快核心数据获取

IOS7内存释放问题

objective-c - 为什么 self.view 的高度和宽度与 subview 的高度和宽度不同?

iphone - 如何使ios App Store链接带参数?

iphone - 在没有 Apple Developer 帐户的情况下在 iPhone 上测试 react-native 应用程序

objective-c - 动态创建的文本字段验证