Shake method iphone sdk - iphone

I am using iPhone sdk's motionended method to get the shake effect on 3.0.
The problem I am having is that the it works find on the first shake which I play a view, but once the video finished and I shake the device again it doesn't work.
Can anyone help me with this.
Thanks

Something else, like the video player, may have become the first responder after the first time you shake the device. This could be preventing the shake events from getting to your view or controller. You may need to manually restore the first responder status to the element handling the shake by sending it -becomeFirstResponder once the video has finished.

Related

tvos: UIViewController does not receive touchesBegan

I am trying to write an App for Apple tv4 (tvos). When my App starts, the view controller does receive touchesBegan events, as it should.
Without going into too many details, the App creates, moves, and deletes sub-views to respond to the user's interactions.
After a while, the view controller does not receive touchesBegan any more (this is the strange error that I am trying to debug).
Since I think the problem has something to do with the responder chain, I have made the following two experiments:
If I let the view controller override and return true from canBecomeFirstResponder, then the problem still occurs, but it occurs much less frequently.
If I do not override that function and instead check who is the first respnder, then I find that the App has no first responder, even before the strange error occurs. That is to say, the App has no first responder even when it is working properly!
Questions: What can prevent touchesBegan from being invoked? Is it related to the responder change? If so, please explain 2 above.
How exactly are you supposed to "touch" a view rendered on a non-touch screen enabled TV?
You're not.. tvOS doesn't work like iOS in the way that you cannot detect touches because there is no touch screen enabled input device supported on an Apple TV.
Instead, you use the UIFocusEngine to handle interactions with content presented within your view hierarchy.
Check out "Controlling the User Interface with the Apple TV Remote" from Apple's Developer Library for more information.

Implement UITouches Gesture programmatically

Implement UITouches Gesture grammatically:
I want to implement touches gesture by xcode itself,
I looked iOS create touch event programmatically
but there is no answer.
If I am searching any wrong thing please let me know.
It's not easy to synthesize a touch event on the iPhone: you have to use undisclosed API, so you have a high probability of breaking on every update of the iOS and getting rejecting from Apple.
Here's a link that demonstrates how to synthesize a touch event on the iPhone:
Here's another question on StackOverflow: How to send a touch event to iPhone OS?

Is there a callback function for when "Done" is pressed in a Youtube-embedded UIWebview?

I've followed and implemented the following example to embed a Youtube video into my app:
http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps.html
This basically opens the YouTube app in the device and when the user presses "Done" switches the canvas back to my own app. Anyone know if there is a callback method for when this happens. I want to continue playing my app's music which was cut off during the YouTube video playing in the youtube app (I definitely know how to start the music but I need to know when the user has pressed "Done").
Thanks for any help pointing me in the right direction :)
If this is on the iPhone/iPod Touch only, I suspect -viewWillAppear: and -viewDidAppear: will be called on the view controller being shown. You should be able to use these methods to resume playing your app's music. On the iPad, these methods are not called if the view controller is a modal view that isn't full-screen.
See: UIViewController Class Reference

Adding Pinch/Zoom effect to a UIImageView inside a UIScrollView

I have a very basic screen sharing iPhone app, I have successfully added the pinch/zoom effect to my app using a UIImageView inside a UIScrollView.
The UIImageView receives the screen content from the PC on a regular interval. Everything works fine but as soon as I scroll/pinch/zoom it works at first but then it stops, and the delegate method that's updating the image view content stops firing up even though the server still sends the screen content. The whole app seems to be frozen but there are no error messages/exceptions/whatever. Can anyone help me, please?
If you are using NSDefaultRunLoopMode, UIAPPlication adds a run loop mode UITrackingRunLoopMode for tracking scrollview events like scrolling. Since the UIApplication switches from NSDefaultRunLoopMode to UITrackingRunLoopMode any events on NSDefaultRunLoopMode will not be called until UIAPPlication switch back to NSDefaultRunLoopMode.
It might be the problem, the fix is change NSDefaultRunLoopMode to NSRunLoopCommonModes .
If you are not sure whether you are using runloop or not as you mentioned in comment. Just search NSDefaultRunLoopMode in your project.

why is my uialertview being dismissed on applicationdidbecomeActive every other time I resume?

I'm working on a cocos2d game and im using a uialertview for the pause screen, for some reason when i exit out using the home button and then re enter the app the uialertview is dismissed everyother time i exit and relaunch. the uialertview is shown everytime the user exits or a call comes in. the other thing that is weird is that when the alert view is dismissed the darkness around the edges is not present.
any idea how or why this would be dismissed without the user clicking anything.
Not sure if this helps but the game itself does not resume when the alert is dismissed, however your touch events are being recieved by cocos2d becuase when you resume the game you can see the stuff you did while it was paused now shown after a real resume. I know this is vague but I though if anyone might have had this issue before they may know what I'm talking about.
thanks,
Nick
it's a bug
there are some workarounds here
UIAlertViewDelegate method didDismissWithButtonIndex gets called while the phone is sleeping/locked