1.在ios6开发的项目,当用ios7的虚拟机显示的时候会出现UINavigationItem遮挡TableView的问题:
下面是对比显示效果:
我的处理方法是:
在UITableViewController 的viewwillapper方法中加入以下代码:
- -
(void)viewWillAppear:(BOOL)animated - {
-
[super viewWillAppear:animated]; -
if([self respondsToSelector:@selector(edgesForExtendedLayout)]) -
[self setEdgesForExtendedLayou t:UIRectEdgeBottom]; - }
2.ios7还有一个问题是UItableview的第一个section会离头部很大的距离:会出现下面的情况:
原因和ios7的设计有关
有两种方法可以解决,大家可以试一下:
如果你的TableView没有刷新的话可以用下面的代码解决:
在viewWillLoad中添加:
- //设置header
of section grouped -
self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, 10.f)];
如果TableView会刷新页面可以在:viewWillApper中添加相同功能代码:
- CGRect
frame = self.tableView.tableHeaderView.frame; -
frame.size.height = 10; -
UIView *headerView = [[UIView alloc] initWithFrame:frame]; -
[self.tableView setTableHeaderView:headerView];
页面就会显示正常。
原文地址:http://blog.csdn.net/wildcatlele/article/details/15507111