6

我有一个 UIView 从缓冲区获取数据(正在改变)并绘制它。我希望屏幕更新为 10Hz。UIView 被称为窗格,这就是我在 ViewController 中调用它的方式:

        //create graphics to display data
        GraphPane pane = new GraphPane ();
        pane.Frame = UIScreen.MainScreen.Bounds;
        Add (pane); 

        //setup timer to update pane
        NSTimer timer = NSTimer.CreateRepeatingTimer (0.1, delegate {pane.SetNeedsDisplay ();});

这不起作用(从不调用 Pane.Draw),而且我还没有找到一个很好的例子来说明如何做到这一点。任何建议表示赞赏。

4

1 回答 1

11
        timer = NSTimer.CreateRepeatingScheduledTimer (TimeSpan.FromSeconds (0.1), delegate {
            pane.SetNeedsDisplay ();
        });

解决了我的问题。

于 2013-06-14T02:16:39.540 回答