iphone - Use accelerometer in a tab app -
I would like to use the accelerometer in a tab app. All three tabs will reach the current X, Y, Z and make a fun change based on that data. My problem is that where does the accelerometer start up so that all three tabs can be updated based on data? Updates are required only when you are in the current tab.
I can only get it to 'work' if I start 3 accelerometer which is not correct. Will the data go to my appeligit and will the code to change the images in each Nibs View Controller?
Try to use the appidagite only to handle the basic stuff in order to avoid putting the code in an unregistered Try to do I would recommend applying Singleton-class to your accelerometer data.
Singletons is a very basic design pattern, which comes in easy episodes in the environment of mobile devices (less ressources than PCs)
You can read about singleton patterns here:
An easy way to synthesize a singleton class in your project is
Include a follwing file in your project
and within its accelerometer class The following <
later viewed its view controllers Wherever) you can add the same kind of dong to Singleton-class acceleration. The following:
[[yourAccelerometer class shared accelerometer class] yourMethod];
Hope that helps
Sam
Comments
Post a Comment