[英]Using NSTimer to call SetNeedsDisplay in Xamarin for iOS
我有一个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),我没有找到一个如何做到这一点的好例子。 任何建议表示赞赏。
timer = NSTimer.CreateRepeatingScheduledTimer (TimeSpan.FromSeconds (0.1), delegate {
pane.SetNeedsDisplay ();
});
解决了我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.