[英]Using NSTimer to call SetNeedsDisplay in Xamarin for iOS
I have a UIView that takes data (thats changing) from a buffer and plots it. 我有一个UIView从缓冲区获取数据(即更改)并绘制它。 I want the screen udpated at 10Hz. 我希望屏幕以10Hz的频率运行。 The UIView is called pane, and this is how i'm invoking it inside the ViewController: 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 ();});
This isn't working (Pane.Draw is never called), and I've not found a good example of how to do this. 这不起作用(从不调用Pane.Draw),我没有找到一个如何做到这一点的好例子。 Any suggestions are appreciated. 任何建议表示赞赏。
timer = NSTimer.CreateRepeatingScheduledTimer (TimeSpan.FromSeconds (0.1), delegate {
pane.SetNeedsDisplay ();
});
fixed my issue. 解决了我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.