zoukankan      html  css  js  c++  java
  • scrollView的几个属性contentSize contentOffset contentInset

    contentSizescrollview可以滚动的区域,比如frame = (0 ,0 ,320 ,480) contentSize = (320 ,960),代表你的scrollview可以上下滚动,滚动区域为frame大小的两倍。

    contentOffsetscrollview当前显示区域顶点相对于frame顶点的偏移量,比如上个例子你拉到最下面,contentoffset就是(0 ,480),也就是y偏移了480

    contentInsetscrollviewcontentview的顶点相对于scrollview的位置,例如你的contentInset = (0 ,100),那么你的contentview就是从scrollview(0 ,100)开始显示

     

    另外UITableViewUIScrollView的子类,它们在上述属性又有所不同,tabelviewcontentsize是由它的下列方法共同实现的

    1 - (NSInteger)numberOfSections;
    2 - (NSInteger)numberOfRowsInSection:(NSInteger)section;
    3 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
    4 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;
    5 - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;

    它会自动计算所有的高度和来做为它的contentsizeheight.

    例如你在delegate方法

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
        return 100;
    }

    那么你的tabelviewcontentsize就是(320, 4400)

  • 相关阅读:
    Oracle 查看表空间的使用情况SQL语句
    汇总查询
    conky配置2
    数据库更新
    weka简介和回归转自chinakdd
    子查询
    ubuntu常用命令
    查询
    数据库中的连接
    测试用的数据库表及其数据
  • 原文地址:https://www.cnblogs.com/benbenzhu/p/3484022.html
Copyright © 2011-2022 走看看