0

我正在使用此代码来更改项目TListView在运行时在 a 上的显示方式:

// lvContacts: TListView
// cdsContacts: TClientDataSet with two records
// lcfContacts: TLinkListControlToField

lvContacts.Items.BeginUpdate;
dmLocalData.cdsContacts.DisableControls;
try
  lcfContacts.FillExpressions.Clear;
  if MultiDetailsView then
  begin
    lvContacts.ItemAppearance.ItemAppearance := 'MultiDetailItem';
    with lcfContacts.FillExpressions.AddExpression do
    begin
      SourceMemberName := 'PictureData';
      ControlMemberName := 'Bitmap';
    end;
    with lcfContacts.FillExpressions.AddExpression do
    begin
      SourceMemberName := 'Job';
      ControlMemberName := 'Detail';
    end;
    with lcfContacts.FillExpressions.AddExpression do
    begin
      SourceMemberName := 'email';
      ControlMemberName := 'Detail1';
    end;
    with lcfContacts.FillExpressions.AddExpression do
    begin
      SourceMemberName := 'mobilePhone';
      ControlMemberName := 'Detail2';
    end;
    with lcfContacts.FillExpressions.AddExpression do
    begin
      SourceMemberName := 'landLinePhone';
      ControlMemberName := 'Detail3';
    end;
  end else begin
    lvContacts.ItemAppearance.ItemAppearance := 'ImageListItemBottomDetail';
    with lcfContacts.FillExpressions.AddExpression do
    begin
      SourceMemberName := 'PictureData';
      ControlMemberName := 'Bitmap';
    end;
    with lcfContacts.FillExpressions.AddExpression do
    begin
      SourceMemberName := 'Job';
      ControlMemberName := 'Detail';
    end;
  end;
finally
  lvContacts.Items.EndUpdate;
  dmLocalData.cdsContacts.EnableControls;
end;

我使用Instruments在 iPhone 上监控了我的应用程序,TMoveArrayManager每次执行此代码时,我都会看到大约 1 GB 的泄漏实例。仅仅几次之后,我的 iPhone 内存不足并关闭了我的应用程序。我试图找到一种更好的方法来在运行时处理和创建实时绑定,但找不到更好的解决方案。有没有人遇到过这样的实时绑定问题?

4

0 回答 0