Thursday, February 26, 2009 at 2:58 PM | 0 comments  
My last summaries were mainly about broader topics. The things that I've covered recently are cool features so here is a summary of the features I've covered:

4. Features
  • Animation
  • Touches
  • Accelerometer
  • Location
  • Camera
Posted by JP
The last chapter that I covered before the completion of this book was on using the camera. One of the IPhone's main limitations is that you are generally restricted to your own application's "sandbox" meaning that you can not access things outside of your own data. The camera is an exception to this. An application can not only access your camera, but can also access your library. In a simple application that I made through following the tutorial, you can either take a picture with your camera, or choose a picture from your library and it will display it on the screen. It is a very simple application that allows you to see how this works.
Posted by JP
Another awesomely cool feature of the IPhone and IPod Touch is the built in accelerometer which can detect when the device is moving. The accelerometer is a 3-dimensional one in that it can detect movement in any direction. This lends to some interesting applications including ones that sense whether the IPhone is being shook (maybe to erase a drawing in a paint program) or tilted (to steer a car in a racing program) among others. Luckily, it's very simple to use. I followed two tutorials from this chapter. One detects if the device is being shook and makes a breaking glass sound and shows a picture of a broken screen. The other simulates the rolling of a marble depending on how you tilt your screen. Both are very cool. I've uploaded the sample code.



Posted by JP
Tuesday, February 24, 2009 at 5:27 PM | 0 comments  
I finally got to learn how to use the Location functionality of the IPhone. The IPhone can determine your location via GPS, cell phone triangulation, or WIFI. It will automatically use whatever is available. It is fairly accurate within 10 meters. It will drain your battery however if you are constantly polling for location so make sure to be careful about polling. It was very easy to use the Location API as most of the work is done for you. This opens up many new possibilities for application ideas.


Posted by JP
I just got through a relatively short chapter on touches/taps/gestures. The IPhone can recognize up to 5 fingers touching the screen at once and can figure out how many consecutive taps one finger is doing. You can also program the IPhone to recognize certain gestures. In one of the tutorials I was able to get the IPhone to recognize a checkmark gesture. The code is uploaded.




Posted by JP
Sunday, February 22, 2009 at 12:07 PM | 0 comments  
I finally got to start doing animation! There are two main ways to do animation. The first is using Quartz and the second is with OpenGL-ES. Quartz is really simple to use and with it you can easily create 2-D animations. OpenGL-ES is for 2-D and 3-D animations and is much more powerful and much more difficult to use than Quartz. It takes advantage of various hardware acceleration mechanisms to draw things efficiently unlike Quartz. For this tutorial I made a paint application using both Quartz and OpenGL-ES. Using Quartz was much simpler for this application. Without prior knowledge of how OpenGL works, beginners might want to stick with Quartz for their 2-D creations.
Posted by JP
I finished the chapter on data persistence. Being able to save application data is very important for applications that require things to be saved between different runs of the application. There are three main ways of persisting data; property lists, archiving, and SQLite3.

Property lists are really easy and convenient but only work for serializable objects that can be put into a dictionary or array. You can't put custom classes into property lists though.

Archiving allows you to write any objects to files as long as you specify how it will be done by supporting certain protocols.

SQLite3 is the IPhone's version of SQL. It is for storing large amounts of data in a database. This requires knowledge of the SQL language. I didn't do much with this because this book doesn't talk too much about SQL.
Posted by JP