![](/img/trans.png)
[英]Unable to disable autofill on keyboard on iOS 15 swift. Xcode 13
[英]Xcode 6: iOS Swift. How to get in game frame rate (fps)?
在我當前的iOS Swift項目中,我需要在運行該設備的設備上將其除以當前FPS。 就我而言,該程序正在我的iPad mini上運行。 我沒有看到執行此操作的功能或任何功能。 有任何想法嗎? 提前致謝!
但是,“ GameViewController.swift”中有一行:
skView.showsFPS = true
但是我無法訪問此值。
您可以在didMoveToView:(SKView *)view
方法中訪問SKView frameInterval
屬性。
如果值為1,則您正在運行60 FPS。 如果值為2,則您以30 FPS的速度運行。 別的,拿出您的計算器。
您可以在Apple SKView 文檔中閱讀更多詳細信息。
您在GameViewController中設置FPS:
skView.frameInterval = 2;
將整數轉換為浮點數:
int myInt = 10;
float myFloat = (float)myInt;
我以前從未使用過iOS,但是在android上,我在onDraw函數上使用了類似的方法:
dt = currentTime - lastTime;
lastTime = currentTime;
tempDt += dt;
fps += 1;
if (tempDt >= 1000) {
Log.d("FPS", String.format("%d", fps));
tempDt = 0;
fps = 0;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.