[英]Xamarin iOS - Simulator View is not refreshing
我在ViewController中有一個簡單的代碼在Xamarin for iOS中內置:
void LogMessage (string message)
{
logText.Text += string.Format("\n{0}", message));
}
其中logText是:
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UILabel logText { get; set; }
代碼被調用,logText的Text屬性正在正確更新,但是在iOS Simulator中,我看不到任何更改。 我嘗試用UITextView
替換UILabel
,但是沒有任何變化。
如果您嘗試從后台線程更新UI,它將無法正常工作。 要在UI線程上強制進行更新,請嘗試以下操作
InvokeOnMainThread (delegate {
logText.Text += string.Format("\n{0}", message));
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.