I have a simple piece of code built in Xamarin for iOS in my ViewController :
void LogMessage (string message)
{
logText.Text += string.Format("\n{0}", message));
}
where logText is:
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UILabel logText { get; set; }
The code is being called, the Text property of the logText is being updated properly, but in iOS Simulator I see no change at all. I tried replacing UILabel
with UITextView
but nothing changes.
If you are trying to update the UI from a background thread, it will not work. To force the update on the UI thread, try this
InvokeOnMainThread (delegate {
logText.Text += string.Format("\n{0}", message));
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.