I am working on an app that manages the alpha property of image views. Alpha property can increase/decrease as the user moves the phone. I saw something on here about using a subclass of UIAccelerometer. Can anyone help me to do this so that I can test it on simulator? Thanks
iOS Device: Shake the device a little bit. iOS Simulator: Hit Ctrl + Cmd ⌘ + Z on a Mac in the emulator to simulate the shake gesture, or press Cmd ⌘ + D . Android Device: Shake the device vertically a little bit.
The simulator does a really lousy job of indicating app performance. In fact it doesn't try. For most things the simulator is much, much faster than an iOS device. It runs your code on an x86 processor, which is much faster than the ARM and has many times more memory.
An accelerometer measures changes in velocity along one axis. All iOS devices have a three-axis accelerometer, which delivers acceleration values in each of the three axes shown in Figure 1. The values reported by the accelerometers are measured in increments of the gravitational acceleration, with the value 1.
In the Hardware menu, choose Shake Gesture. That's it. Your shake handler should be called when you do so.
Yo cant test it using simulator, you should use real device for testing accelerometer. Check here, it may help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With