在iOS 7中,viewForHeaderInSection部分从1开始而不是从0开始 [英] in iOS 7 viewForHeaderInSection section is starting from 1 not from 0

查看:68
本文介绍了在iOS 7中,viewForHeaderInSection部分从1开始而不是从0开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



有什么问题是 UITableView 框架的问题是什么? / p>

我无法理解发生了什么



提前致谢

解决方案

刚遇到完全相同的问题,分辨率非常简单。



只需实现此委托方法:

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

表格 Apple UITableViewDelegate Protocol Reference ,它提到了


讨论



返回的对象可以是UILabel或UIImageView对象,也可以是自定义视图。只有在实现tableView:heightForHeaderInSection:时,此方法才能正常工作。



I am dealing with UITableView in my project and this project is created in Xcode 4.5 and now I am working with Xcode 5, so my question is when I will run my project in iOS 6 , the viewForHeaderInSection method section is starting from 0 it's ok but If I will use iOS 7 to run viewForHeaderInSection section is starting from 1 not from 0

What is the problem is there any UITableView frame's problem or not

I can't understand what is going on

Thanks in Advance

解决方案

Just encountered exactly the same issue, and the resolution turns out very simple.

Just implement this delegate method:

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

Form Apple UITableViewDelegate Protocol Reference, it mentioned

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.

这篇关于在iOS 7中,viewForHeaderInSection部分从1开始而不是从0开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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