avaudioplayer-two background music problem - background

I have two .xibs in my app. The first .xib contains a round rectangle button that opens second .xib. ViewDidLoad method of second .xib starts a background music(mp3 file) using AVAudioPlayer and then shows an animation by running a sequence of images. Now second .xib button has a "back button".
If I click on the back button before animation and audio stops, reach on first xib and click on round rectangle button again then it starts two background music files.
How do I fix it?
Also, how do you stop music if a song is already playing on ipod when app's background music starts?

Related

How can I pause the dynamic animator in objc?

I have two UIViews. I use UIDynamicAnimatior. I add gravity and collision to these UIviews. When the app starts, I want to pause the animation when I tap the screen or switch the app to the background. When I tap the screen again, the app will resume.

how to do a "app launch like" fade - zoom ios 7 transition?

I need to achieve the IOS7 app launch transition, in which the the detail view appears with fade effect according to the rectangle frame of the button that fired this view, as described in the image below:
So I have a main ViewController with six buttons, I want to make transition to the details viewControllers with fade and zoom effect, and starting the animation depending of the button frame.
I found RZTransitions, amazing collection of custom transitions, it does exactly what I want but for uicollectionView, I tried but can't get working to do the same for a viewController.
Thanks.

MPMovieplayerController show blackscreen when app enter foreground from background

I have seen the same question but not have the right solution, so I decided to post my own problem.
I'm using an MPMoviePlayerController for playing video in iOS app. I can make it to play in background within my app or even when user tap on Home button (play in background).
The problem is when MPMoviePlayerController is playing, press home button on iPhone, make the app enter
background. Then tap the app's icon to make the app enter foreground, the MPMoviePlayerController's view will be black screen, audio still continue, only video screen cannot see anything.
This is NOT happen if in background, MPMoviePlayerController play the next video, when come foreground from background it works perfectly. And it also not happen in iOS6 or before.
So in inclusion the problem occurred when play the itself video in iOS7
How to make the MPMoviePlayerController's video shows immediately when app came to foreground?
Many thanks for any help!

Objective-c call touch on screen without user touching the screen

Im going to be using a framework that allows a iphone app to control my app on iPad. When i add it im going to make the joystick move a image of a mouse, and when the user presses the A button, i want to make the device think the user is touching at that point. Is there any way to do this?
Example: I place a button on the ipad screen at 0,0 with height and width of 100. then mouse is at point 50,50 and when the user presses and holds A, that button is held down, and when user lifts up, it calls that buttons action.

Please put me on the right track with Drag Drop on IOS

I am creating a bit of a video mash up app (like imovie) and the first function I am tackling is the ability to drag a thumbnail from a video library and drop it on a time line. I was able to add the drag code to the video thumbnail class so when you touch it, it creates a drag proxy view which moves around when you move your finger. Next I want to be able to drop it on the time line.
My Timeline is also a uiview and I am unsure of how it can receive notification that the thumbnail is being dragged over it! It will need the position of the thumbnail so that it can show it on the timeline and the duration of the clip and such (information that I have attached to my video thumbnail object)
How would you approach this issue? The App is for ipad and is on ios 5.
Thanks for any pointers!
You will most likely want to subclass the UIView. You can look at this post:
https://stackoverflow.com/a/4130641/1535038
Mainly you will want to see if the My Timeline view is being touched, and then see if you are in the middle of a drag or not.