(转)处理ios6到ios7后UITableView的两个显示问题

1.在ios6开发的项目,当用ios7的虚拟机显示的时候会出现UINavigationItem遮挡TableView的问题:

下面是对比显示效果:




我的处理方法是:

在UITableViewController 的viewwillapper方法中加入以下代码:

 

[objc]  view plain copy print ?
  1. (void)viewWillAppear:(BOOL)animated  
  2.  
  3.     [super viewWillAppear:animated];  
  4.     if([self respondsToSelector:@selector(edgesForExtendedLayout)])  
  5.         [self setEdgesForExtendedLayout:UIRectEdgeBottom];  
  6.  


 

2.ios7还有一个问题是UItableview的第一个section会离头部很大的距离:会出现下面的情况:





原因和ios7的设计有关

有两种方法可以解决,大家可以试一下:

如果你的TableView没有刷新的话可以用下面的代码解决:

在viewWillLoad中添加:

 

[objc]  view plain copy print ?
  1. //设置header of section grouped  
  2.     self.tableView.tableHeaderView [[UIView alloc] initWithFrame:CGRectMake(0.0f0.0fself.tableView.bounds.size.width10.f)];  

如果TableView会刷新页面可以在:viewWillApper中添加相同功能代码:

 

 

[objc]  view plain copy print ?
  1. CGRect frame self.tableView.tableHeaderView.frame 
  2.   frame.size.height 10 
  3.   UIView *headerView [[UIView alloc] initWithFrame:frame];  
  4.   [self.tableView setTableHeaderView:headerView];  

页面就会显示正常。

 



原文地址:http://blog.csdn.net/wildcatlele/article/details/15507111

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值