2014-09-11 84 views
0

我使用monotouch.dialog來開發一個PrivateMsg通話屏幕。但是當我重新加載單元格時,單元格閃爍,如何避免它?如何避免重新加載單元格時的可用視圖單元格刷新閃爍

添加新下午MSG翻過2步驟:1.附加一個元件細胞:State.Insert(MSG被髮送)=> 2.重新加載元件小區狀態:State.Updated(MSG發送sucessced)

PLS找到附件:屏幕錄製文件和源代碼:

​​

void HandleOnPMChanged(object sender, PMChangedEventArgs e) 
    { 
     if (e.PMSID != this.mPMSession.PMSID) 
      return; 

     this.BeginInvokeOnMainThread(() => 
     { 
        if (e. State == State.Insert) //step1 
        { 
         element = this.GetNewPMElement(itemData); 
         pmSection.Add(element); 
         this.ScrollToBottomRow(); 
        } else if (e.State == State.Update && e.PM != null) //step2 
        { 
         var element = FindElement(e.PM.Guid.GetHashCode()); 
         if (element != null) 
         { 
          var indexPaths = new NSIndexPath [] { element.IndexPath }; 
          this.TableView.ReloadRows(indexPaths, UITableViewRowAnimation.None); //this line will flicker 
          //remark: this.ScrollToBottomRow(); 
         } 
        } 
        else if (e. State == State.Insert) 
        { 
         element = this.GetNewPMElement(itemData); 
         pmSection.Add(element); 
         this.ScrollToBottomRow(); //step1 
        } 
     }); 
    } 



    public void ScrollToBottomRow() 
    { 
     try 
     { 
      if (pmSection.Count < 1) 
       return; 

      NSIndexPath ndxPath = pmSection[pmSection.Count - 1].IndexPath; 
      if (ndxPath != null) 
       this.TableView.ScrollToRow(ndxPath, UITableViewScrollPosition.Bottom, false); //Bottom, false); 
     } 
     catch (Exception ex) 
     { 
      Util.ReportMsg("PMDVC ScrollToBottomRow Exception:", ex.Message); 
     } 
    } 

回答

1

問題已得到修復。

EstimatedHeight回報大於實際值。

相關問題