【问题标题】:NSTimer UILabel not updating in MonoTouchNSTimer UILabel 未在 MonoTouch 中更新
【发布时间】:2013-07-19 07:38:44
【问题描述】:

我正在尝试更新 NSTimer 中的 UILabel。

LoadingOverlay.Hidden = false; 
NSTimer.CreateScheduledTimer(new TimeSpan(0, 0, 0, 0, 1),     
delegate {Callback(obj); LoadingOverlay.Hidden = true;};

我想在回调中更新 UILabel,但它不起作用。有什么建议吗?

【问题讨论】:

    标签: c# xamarin.ios uilabel nstimer


    【解决方案1】:

    您需要使用 InvokeOnMainThread 在 UI 线程上执行您的 UI 更改。

    InvokeOnMainThread(delegate{
        LoadingOverlay.Hidden = true;
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多