Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
iPhone が特定の方向 (X 軸) に動いていることを検出するにはどうすればよいですか? サンプルコードを表示できますか?
UIAccelerometer の助けを借りてそれを行うことができ、次の方法で x 軸の電話の動きを確認できます。
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)aceler { if (sqrt(aceler.x * aceler.x) > 1.5f) { //write your code here } }
お役に立てれば。
ありがとう、
マドゥップ