So, I’m using the function below to return some tilt info. I am also removing the listener when I exit the scene using this - Runtime:removeEventListener( "accelerometer", onTilt )
.
However I notice that while viewing the Xcode console, the accelerometer events keep firing after I change scenes. Apparently NOT unloading the event listener. Any thoughts as to how I can remove that so as to not eat up memory and battery? What am I doing wrong? Thanks.
Brian
local function onTilt( event )
motionx = (30 \* event.yGravity)
print(motionx)
if motionx \> 0 then
transition.to( homeSign, { time=300, rotation=3 })
else
transition.to( homeSign, { time=300, rotation=-3 })
end
end
Runtime:addEventListener( "accelerometer", onTilt )
[import]uid: 141982 topic_id: 37285 reply_id: 67285[/import]