Friday, March 4, 2011

IOS programming: an app to listen to an audio file

IOS programming: an app to listen to an audio file...

Very interesting day today at the programming course sponsored by the iOS. We primarily learned how to work with some framework that we interact with the hardware and other applications of the device. Especially today, we have worked with the camera, with the library, with the mail manager and with the sounds. The code that we release is very simple, it is a small App that plays .MP3 files loaded by us. First of all download the code from here. To realize how it works, open the project and launch the application by pressing the button Build and Run: we view with two buttons that start and stop the music, and two slides that control the volume (bass) and the time of the song (the top). If we try to press the button or move the slide we see that everything is working.





Let's take a look at the code and, as usual, the file we are interested in are: AudioPlayerViewController and AudioPlayerViewController m. AudioPlayerViewController in Classes and in the Resources folder .xib. The first and the second includes the code, the third controls graphical interface. Let's open the xib file and see that opens the program Interface Builder that shows the screenshot of our application. If we try to right click on each of these elements, we will see that in the window that opens each have events or actions, and are the same that we define in h. Then we can say that the h-file., which is a header file, serves as the intermediary between the m and the xib files. In reality, buttons and sliders, you can directly create, write in the code file, but the procedures are getting longer, and the convenience of Interface Builder lies in saving code for graphical elements. Our song is in the Resources folder, but in reality these folders are only conventional and useful in the development phase, because when we go to compile the application all the multimedia files will be in the root.

Now open the file AudioPlayerViewController. m, and following comments take a look at what has been done. In practice, we sought the song "ne device, we initialized, we linked to his life and his two-volume slider, and finally we connected the two buttons on the actions that we didn't care. These control actions are not native framework by default, but we could use AVFoundation framework. importing the framework found in the Framework folder.

As I said earlier today, we've also interacted with other functions of the device hardware and software, as the camera, send the mail and photo gallery. We are on the penultimate day, and essentially we got to know most of the functionality of the device. Discussing with the other members of the course (around 4 US), we nevertheless noticed that 5 days are few, because both arguments that how to deal with them are plentiful. Hence my further reference to distrust towards those who are the courses that last only two days and become an insignificant and expensive code cauldron. Do not doubt the competence of their proponents, as a real possibility and ability of participants to be able to understand something and being able to release any application!

See you tomorrow for an update about the last day of the course and my conclusions.

No comments:

Post a Comment