关于在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. CUDA编程-(2)其实写个矩阵相乘并不是那么难

    程序代码及图解析: #include <iostream> #include "book.h" __global__ void add( int a, int b, i ...

  2. MVC Model 数据注解与验证

    常用验证特性: using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Sch ...

  3. 怎样在Yii中显示静态页

    在web应用中,我们经产更需要显示静态页,如“关于我们”等,这些文件通常是静态页,通常有如下几种处理方法: 1.把独立的html文件存在Web服务器能直接访问的目录下.这种方案的缺点是很难维护网页布局 ...

  4. Android——打造万能适配器(CommonAdapter)

    List<T> : ListView -> Adapter extends BaseAdapter -> ViewHolder ViewHolder CommonAdaper ...

  5. ASP.NET- LinkButton 传递多个参数

    在使用LinkButton时可能会遇到需要传递多个参数的问题,而LinkButton的用来传递参数的属性commandargument需要传递的是一个string类型的值.因而传递多个参数时需要进行一 ...

  6. Creating custom datatypes using the umbraco usercontrol wrapper

    本篇文章介绍的是基于UmbracoCMS技术搭建的网站所使用的相关技术. 1.      需求 Umbraco CMS的dataType中有richTexhEditor控件,但是它不是太完善,比如没有 ...

  7. 蜗牛—JSP学习之JavaBean初识

    初识: <%@ page language="java" import="java.util.*" pageEncoding="utf-8&qu ...

  8. Nginx介绍 分类: Nginx 服务器搭建 2015-07-13 10:50 19人阅读 评论(0) 收藏

    海量请求,高性能服务器. 对比Apache, Apache:稳定,开源,跨平台,重量级,不支持高度并发的web服务器. 由此,出现了Lighttpd与Nignx:轻量级,高性能. 发音:engine ...

  9. Android自定义“图片+文字”控件四种实现方法之 二--------个人最推荐的一种

    http://blog.csdn.net/yanzi1225627/article/details/8633872 第二种方法也要新建一个图片+文字的xml布局文件,然后写一个类继承自LinearLa ...

  10. android 67 生成和解析xml

    生成xml: package com.itheima.createxml; import java.io.File; import java.io.FileNotFoundException; imp ...