cacheBuffer 属性:
此属性将会额外的在现实区域之外,加载并实例化delegate,delegate 的数量由delegate 的高度以及cacheBuffer 的大小决定。
需要注意的是:此属性仅仅是缓存额外的delegate,并不是一个像素缓存区。
官方描述:
cacheBuffer : int
This property determines whether delegates are retained outside the visible area of the view.
If this value is greater than zero, the view may keep as many delegates instantiated as it can fit within the buffer specified.
For example, if in a vertical view the delegate is 20 pixels high and cacheBuffer is set to 40, then up to 2 delegates above and 2 delegates below the visible area may be created/retained.
The buffered delegates are created asynchronously, allowing creation to occur across multiple frames and reducing the likelihood of skipping frames. In order to improve painting performance delegates outside the visible area are not painted.
The default value of this property is platform dependent, but will usually be a value greater than zero. Negative values are ignored.
**Note that** cacheBuffer is not a pixel buffer - it only maintains additional instantiated delegates.
Note:
Setting this property is not a replacement for creating efficient delegates. It can improve the smoothness of scrolling behavior at the expense of additional memory usage.
The fewer objects and bindings in a delegate, the faster a view can be scrolled.
It is important to realize that setting a cacheBuffer will only postpone issues caused by slow-loading delegates, it is not a solution for this scenario.
The cacheBuffer operates outside of any display margins specified by displayMarginBeginning or displayMarginEnd.