iphone - How can I outsource view-change-operations from my view controller upon accelerations? -


I have a view controller class. I want to do some things in my thoughts when detects accelerometer movement and accelerometer Call: didAccelerate:. Method in the representative object

This is the reason that the representative object is a problem here in my brain. At present, my brain is silent and I do not get what it would be better I know what you think.

Solution 1) My view is that the controller class is consistent with the UIAccelerometerDelegate Protocol, and in that accelerometer apply: didAccelerate : Method. In -applicationDidFinishLaunching: In the form of my AppDelegate class, I receive the call on the method acceleration of that view controller object acceleration as representative. I think that's not really good

solution 2) I create an empty new object named AccelerationDelegate, that corresponds to the UIAccelerometerDelegate Protocol, that applies the accelerometer. DidAccelerate: Method and -application in DiffFinishLaunching: The method of my AppDelegate class I set upset as the delegate to receive method call on that view controller acceleration.

But for the solution 2 my mind got stuck a bit! How do I use visual objects from my visual controller inside that object?

The problem here is that I have more than one view controller I can use a tab bar controller to switch between them.

Any suggestions how I think might be right?

After

If your acceleration is specific to a view controller, then see that the controller has its own sub- It is understandable to obtain the necessary information to change the sequences, however, when the view is visible, its view controller may be better to become a representative, and when it disappears, Can be set for. (Specifically, - (zero) viewWillAppear: and - (zero) viewWillDisappear: )


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -