Iphone开发(十四)深入理解scrollView的contentOffset等属性,实现下拉刷新功能
It sets the distance of the inset between the content view and the enclosing scroll view.aScrollView.contentInset = UIEdgeInsetsMake(0, 0, 0, 7.0);
Here's a good?iOS Reference Library article on scroll views?that has an informative screenshot (fig 1-3) - I'll replicate it via text here:
_|←_cW_→_|_↓_ | | --------------- |content| ↑ ↑ |content| contentInset.topcH |content| ↓ |content| contentInset.bottom |content| ↓--------------- _|_______|___ ↑ (cH = contentSize.height; cW = contentSize.width)
The scroll view encloses the content view plus whatever padding is provided by the specified content insets.
?
scrollView中还有好多别的属性,比如tracking,zooming,decelerating等,什么 touch 后还没拖动的时候,滚动后手放开的时候,是否要自动滚到subView的边界处等等,网上有很好的总结说明,官方library里也介绍得很详细很形象,这里就不多说了,上面介绍的这三个属性很基本很重要,如果要加深理解,可以看我附件中的代码,下拉刷新的,参照网上一个朋友的源码自己实现了一下,果然很好用;另外,scrollView也经常用在登陆界面中,一般是弹出键盘时候,输入框的向上平移,所以,反正很重要;对了,下拉刷新一般都是和tableView一块儿实现,tableView也是scrollView;
?