日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

scrollView的几个属性contentSize contentOffset contentInset

發布時間:2024/4/17 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 scrollView的几个属性contentSize contentOffset contentInset 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

contentSize是scrollview可以滾動的區域,比如frame = (0 ,0 ,320 ,480) contentSize = (320 ,960),代表你的scrollview可以上下滾動,滾動區域為frame大小的兩倍。

contentOffset是scrollview當前顯示區域頂點相對于frame頂點的偏移量,比如上個例子你拉到最下面,contentoffset就是(0 ,480),也就是y偏移了480

contentInset是scrollview的contentview的頂點相對于scrollview的位置,例如你的contentInset = (0 ,100),那么你的contentview就是從scrollview的(0 ,100)開始顯示

?

另外UITableView是UIScrollView的子類,它們在上述屬性又有所不同,tabelview的contentsize是由它的下列方法共同實現的

- (NSInteger)numberOfSections;

- (NSInteger)numberOfRowsInSection:(NSInteger)section;

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;

它會自動計算所有的高度和來做為它的contentsize的height.

?

例如你在delegate方法

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

????return 100;

}

那么你的tabelview的contentsize就是(320, 4400)

?

zhuan:http://hi.baidu.com/cuikun050959/item/71095500d50e9cd2dce5b021

轉載于:https://www.cnblogs.com/AbelChen1991/p/3662230.html

總結

以上是生活随笔為你收集整理的scrollView的几个属性contentSize contentOffset contentInset的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。