簡體   English   中英

xamarin.ios 滾動視圖和編輯器滾動編輯器

[英]xamarin.ios Scrollview and Editor Scrolling Editor

在我的應用程序中,我在 ScrollView 中有一個編輯器。 如果文本大於編輯器高度,我希望能夠在不單擊編輯器內部的情況下滾動編輯器。 我有一個用於編輯器和 ScollView 的 CustomRenderer,但哪些設置是可能的?

謝謝。

如果要讓Editor自動滾動到底部,可以在EditorRenderer 中使用以下代碼

protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
{
  base.OnElementChanged(e);

  if(Control!=null)
  {
     Control.LayoutManager.AllowsNonContiguousLayout = false;
     Control.ScrollRangeToVisible(new NSRange(Control.Text.Length-1,1));
  }

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM