关于在navigationController下面使用tableView在竖直方向会遇到frame的y值的困惑,
会遇到视图控制器的这个属性:automaticallyAdjustsScrollViewInsets.
  apple的解释:
 

A Boolean value that indicates whether the view controller should automatically adjust its scroll view insets.

The default value of this property is YES, which allows the view controller to adjust its scroll view insets in response to the screen areas consumed by the status bar, navigation bar, and toolbar or tab bar. Set to NO if you want to manage scroll view inset adjustments yourself, such as when there is more than one scroll view in the view hierarchy.

 

  这是指示ViewController是否自动调整subview中的scrollView位置的布尔变量。
  此属性的默认值是YES,它使得视图控制器来调节响应的状态栏,导航栏占用的屏幕区域的scrollview,和toolbar或tabBar。,如果你要自己管理插入调整scrollView就设置为NO。

 在iOS7以下系统,UITableViewCell.superview就是UITableView,但在IOS7中,cell上面还多了一个UITableViewWrapperView,所以需要UITableViewCell.superview.superview获取UITableView
 
iOS 获取操作系统的版本

[[[UIDevice currentDevice] systemVersion] floatValue]

 
 UITableView *tableView;

      float Version=[[[UIDevice currentDevice] systemVersion] floatValue];

     if(Version>=7.0)

     {

        tableView = (UITableView *)self.superview.superview;

     }

     else

     {

         tableView=(UITableView *)self.superview;

     }

      NSIndexPath *indexPath= [tableView indexPathForCell:self];

     indexPath = [NSIndexPath indexPathForRow:kImage1IndexinSection:indexPath.row];

但是今天所做的项目里用到了tabbarController中一个VC的childVC中使用tableView时候,在切换tabbar的VC时,ChildVC的table会掉64(navigationBar的高度),设置automaticallyAdjustsScrollViewInsets 也无效,

所以只好拿到UITableviewWrapperView强行设置frame:

 for (UIView *subview in tableView.subviews)
{
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewWrapperView"])
{
subview.frame = CGRectMake(, , tableView.bounds.size.width, tableView.bounds.size.height);
}
}

应该是automaticallyAdjustsScrollViewInsets的问题,以后研究

参考链接: http://stackoverflow.com/questions/27671324/uitableviewwrapperview-and-uitableview-size-differs-with-autolayout

iOS UITableviewWrapperView 和 automaticallyAdjustsScrollViewInsets属性的更多相关文章

  1. iOS开发-automaticallyAdjustsScrollViewInsets属性

    iOS开发-automaticallyAdjustsScrollViewInsets属性 Available in iOS 7.0 and later. 简单点说就是automaticallyAdju ...

  2. iOS数据存储之属性列表理解

    iOS数据存储之属性列表理解 数据存储简介 数据存储,即数据持久化,是指以何种方式保存应用程序的数据. 我的理解是,开发了一款应用之后,应用在内存中运行时会产生很多数据,这些数据在程序运行时和程序一起 ...

  3. 关于tableView的那些坑(一)—— automaticallyAdjustsScrollViewInsets属性

    最近用tabbar来切换控制器,用childViewController来实现多控制器管理,多列表切换,在子控制器中设置了automaticallyAdjustsScrollViewInsets属性为 ...

  4. Pop–实现任意iOS对象的任意属性的动态变化

    简介 Pop 是一个可扩展的动画引擎,可用于实现任意iOS对象的任意属性的动态变化,支持一般动画,弹性动画和渐变动画三种类型. 项目主页: pop 最新示例: 点击下载 注意: 官方代码中,并不包含实 ...

  5. iOS edgesForExtendedLayout、extendedLayoutIncludesOpaqueBars、automaticallyAdjustsScrollViewInsets属性详解

    edgesForExtendedLayout: 在IOS7以后 ViewController 开始使用全屏布局的,而且是默认的行为通常涉及到布局,就离不开这个属性 edgesForExtendedLa ...

  6. 【转】iOS学习之translucent属性

    原文地址:http://www.jianshu.com/p/930643270455 总所周知,苹果从iOS7开始采用扁平化的界面风格,颠覆了果粉们"迷恋"的拟物化风格.对于开发者 ...

  7. [IOS]edgesForExtendedLayout、automaticallyAdjustsScrollViewInsets

    在IOS7以后 ViewController 开始使用全屏布局的,而且是默认的行为通常涉及到布局 就离不开这个属性 edgesForExtendedLayout,它是一个类型为UIExtendedEd ...

  8. edgesForExtendedLayout、extendedLayoutIncludesOpaqueBars、automaticallyAdjustsScrollViewInsets属性详解 )——转载

    edgesForExtendedLayout: 在ios7适配中,布局问题是一个很头痛也很重要的问题,因为在ios7中viewController使用了全屏布局的方式,也就是说导航栏和状态栏都是不占实 ...

  9. iOS开发之--UITextField属性

    UITextField属性 0.     enablesReturnKeyAutomatically 默认为No,如果设置为Yes,文本框中没有输入任何字符的话,右下角的返回按钮是disabled的. ...

随机推荐

  1. poj 2586 Y2K Accounting Bug

    http://poj.org/problem?id=2586 大意是一个公司在12个月中,或固定盈余s,或固定亏损d. 但记不得哪些月盈余,哪些月亏损,只能记得连续5个月的代数和总是亏损(<0为 ...

  2. __str__

    __str__是被print函数调用的,一般都是return一个什么东西.这个东西应该是以字符串的形式表现的.如果不是要用str()函数转换.当你打印一个类的时候,那么print首先调用的就是类里面的 ...

  3. Linux Mono Asp.net 部署方案

    1.Jexus 国内的 官网:http://www.jexus.org 2.Apache 官网:http://mono-project.com/Mod_mono 3.Nginx 官网:http://m ...

  4. bzoj 3226 [Sdoi2008]校门外的区间(线段树)

    3226: [Sdoi2008]校门外的区间 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 615  Solved: 227[Submit][Stat ...

  5. 腾讯sdk配置

    android-mirror.bugly.qq.com

  6. java读取配置文件

    java 读取文件可以用字节流和字符流. 由于一个汉字占两个字节,所以如果配置文件中有汉字,用字节流读取,会出现乱码. 用字符流则不会出现乱码. 配置文件 b.properties 文件如下: fam ...

  7. IO 流—>>>补充

    流操作规律: 示例:1. 源: 键盘录入 目的: 控制台 2.源:文件 目的:控制台 3.源: 键盘录入 目的: 文件 基本规律: 面对流对象很多,不知道用哪一个的时候: 通过两个明确来完成 1.明确 ...

  8. PAT 1074. Reversing Linked List (25)

    Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elem ...

  9. Java NIO使用及原理分析(二)

    在第一篇中,我们介绍了NIO中的两个核心对象:缓冲区和通道,在谈到缓冲区时,我们说缓冲区对象本质上是一个数组,但它其实是一个特殊的数组,缓冲区对象内置了一些机制,能够跟踪和记录缓冲区的状态变化情况,如 ...

  10. PHPExcel的读取excel的操作

    首先导入类库: require_once 'PHPExcel.php'; require_once 'PHPExcel\IOFactory.php'; require_once 'PHPExcel\R ...