MonoTouch.Dialog:元素中文本的更新

Ian*_*ink 2 c# xamarin.ios ios monotouch.dialog

使用MonoTouch.Dialog我添加StyledStringElement元素.

有一个后台任务可以检索需要更新的详细信息 element.Value

是否有办法强制元素在更新后element.Value更新文本?

伊恩

pou*_*pou 12

如果您想逐个元素更新,那么您可以使用以下内容:

public class MyStyledStringElement {

    public void SetValueAndUpdate (string value)
    {
        Value = value;
        if (GetContainerTableView () != null) {
            var root = GetImmediateRootElement ();
            root.Reload (this, UITableViewRowAnimation.Fade);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

一种变化是加载所有内容并更新一次(即迭代root.Reload每次Element).