Tag Archives: iPhone

iPhone – Handle the Application Termination When the Phone Rings

When iPhone rings, the running application will quit until the phone call ends. So in code level, how could we handle this situation.

I found a post by Norman McEntire and he talked about the application behavior when the phone rings. Here is what he found.
Continue reading iPhone – Handle the Application Termination When the Phone Rings

iPhone – Delete Files in the Documents Directory of your iPhone Application

I am working for my next iPhone application which will create an audio file and save it in the Documents directory. I also created a table view which listed all the audio files such that user can delete them. Please note that the Documents directory is the only place where you can store your application files.
Continue reading iPhone – Delete Files in the Documents Directory of your iPhone Application

iPhone – Adding Image to UIBarButtonItem

Update @ 2012-08-02: If you are using XCode 4.3 or above. You could following the instruction provided by S.Littlehales.

I found that if u set an image to the UIBarButtomItem directly, only the shape of the image is shown in the view without any color. If you want to add an button image to UIBarButtonItem, you have to create a UIButton and set it to the view of the UIBarButtonItem.
Continue reading iPhone – Adding Image to UIBarButtonItem

iPhone – Add an UISlider For AVAudioPlayer

We can use AVAudioPlayer to play music. Now i want to add an UISlider as the music progress bar and user can fast skip the music.

Now i have a play button in the view and when user click it, i will play the music file as well as the following method.

  • playButtonClickedRun when the play button is clicked
  • updateSliderRun in 1 second interval to update the UISlider
  • sliderChangeFast skip the music when user scroll the UISlider

Continue reading iPhone – Add an UISlider For AVAudioPlayer

iPhone – Stop the Scheduled NSTimer

Yesterday we talk about how to make use of the NSTimer for scheduling a task.
iPhone – NSTimer Example
 

Sometimes, you may want to stop the scheduled task. Then you can use the invalidate method. If you invalidate a unfired NSTimer, that’s fine. But if you invalidate a fired NSTimer, the application will crashed. So how to by pass the problem?
Continue reading iPhone – Stop the Scheduled NSTimer