[英]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.