我已经将我的ImageCell更改为包含am图像和三个标签的自定义ViewCell。
当细胞出现在屏幕上时,ImageCell正在加载细胞的图像。我的自定义单元在初始加载期间加载所有ViewCells的所有图像。
我如何解决这个问题,或者我如何增强我的自定义ViewCell以实现相同的行为?
谢谢,尼古拉
发布于 2016-04-29 18:12:40
在你的CustomViewCell中,你只需要覆盖OnAppearing和OnDisappearing。
在滚动时调用这两个事件
public class MyCell : ViewCell
{
protected override void OnAppearing()
{
base.OnAppearing();
// Do what happens on appeaering - load image
}
protected override void OnDisappearing()
{
base.OnDisappearing();
// Do what happens on disappeaering - unload image
}
public MyCell()
{
}
}发布于 2016-04-29 15:03:13
只要你没有在后台的任何地方加载它,如果你的列表视图被设置为回收单元格,那么在它们出现之前,它不应该加载它们。
<ListView CachingStrategy="RecycleElement">https://stackoverflow.com/questions/36930402
复制相似问题