ContentOffset
關于ScrollView,Contentoffset這個概念很好理解,就是當前顯示內(nèi)容的頂點與ContentView頂點的偏移量。ContentInset
ContentOffset是指scrollview的contentview的頂點相對于scrollview的位置。但是這個概念可能會有點晦澀,而且很多博客中的圖解也不是很好理解。后來直接查了contentInset屬性的注釋:
@property(nonatomic) UIEdgeInsets contentInset; // default UIEdgeInsetsZero. add additional scroll area around content
我們看到注釋: add additional scroll area around content. 翻譯過來就是在 content 周圍添加額外的滑動區(qū)域,相當于一個包裹于content外的額外區(qū)域,默認為 UIEdgeInsetsZero,即content沒有外包圍。
區(qū)別
- ContentOffset在交互過程中是動態(tài)的,隨用戶滾動scrollview而變化。
- ContentInset在交互過程中是靜態(tài)的,一旦設置好值就不會隨用戶操作而變化。