关于在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. IIS出现Server Error in '/' Application.CS0016的解决办法

    这两天一直在弄IIS的事,全都是报错,网上找了好多资料,也尝试了很多,终于在几分钟之前把困扰了我一周的麻烦给解决了,现整理出来,希望对大家有用,闲话少说,直接上图了 Server Error in ' ...

  2. 数学类杂志SCI2013-2014影响因子

    ISSN Abbreviated Journal Title Full Title Category Subcategory Country total Cites IF        2013-20 ...

  3. SQL Server 除法 不起作用的问题

    SELECT          CASE WHEN  aa.itax is NULL  THEN aa.fskje ELSE        aa.fskje  / ( 1 + (tjob.itax / ...

  4. Eclipse SVN插件安装与使用(2014.12.27——by小赞)

    安装参考:http://www.cnblogs.com/xdp-gacl/p/3497016.html 用法参考:http://blog.sina.com.cn/s/blog_8a3d83320100 ...

  5. install Active Directory域控制器

    设置Active Directory域控制器 正如我们在网络与系统配置专题文章中所提到的那样,我们已将两部服务器设置为对应于内部域“intdomain.com”的Active Directory域控制 ...

  6. 在Dubbo中开发REST风格的远程调用(RESTful Remoting)

    rest 在Dubbo中开发REST风格的远程调用(RESTful Remoting)

  7. 让IE6兼容position:fixed

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. java-mina(nio 框架)

    mina是对nio的具体实现.是目前比较高效和流行的nio框架了. 下面是对使用mina进行通讯的一个简单demo,后面再用mina写一个RPC的简单框架.   mina主要包括: (使用的mina版 ...

  9. radix树

    今天在学Linux内核页高速缓存时,学到了一种新的数据结构radix树(基数),经过分析,感觉此数据结构有点鸡肋,有可能是我理解不到位吧. 先来张图,给大家以直观的印象 当有一个key-value型的 ...

  10. SignalR及时通知功能

    功能需求,现时已经编写了一个hub能够,将后台的消息发送至前台中,并给出提示,但如后台已经发生了变化,由内部调用消息时,应该怎样处理? 1.编写Hub类 using System.Collection ...