Thursday, February 26, 2009
at
2:58 PM
|
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
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.
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.

Tuesday, February 24, 2009
at
5:27 PM
|
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.
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.
Sunday, February 22, 2009
at
12:07 PM
|
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.

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.
Tuesday, February 17, 2009
at
2:34 PM
|
Here's a continuation of my last summary to help tie things together into a curriculum idea.
2. Model View Controller (continued)
- Navigation Bar --> tables, Nav application
- Auto rotation --> show how to use this
3. Data Persistence
- Settings --> AppSettings
- Property Lists
- Archiving
- SQLite3
Today I finished a tutorial on application settings. This tutorial was a short simple tutorial to show how the IPhone can use something known as a settings bundle to keep track of application preferences. In the SDK you do this by editing a plist file which is a cool file specifically formatted for being read like this. It's really easy to use. The end result is your application having it's own "settings" in the main settings section of your IPhone. I'll upload the source code shortly.
Wednesday, February 11, 2009
at
11:57 PM
|
This was a tough chapter. There's so much stuff in here for navigation bars. They work somewhat similar to a tab bar in that it manages different views. However, a navigation bar works as a stack so it has a root view and then when you navigate to a different view, that view gets pushed onto the stack. Navigation bars work hand in hand with tables. Each row in a table will generally represent a link to another view. I uploaded the source code to my navigation tutorial application.
Sunday, February 8, 2009
at
10:25 PM
|
I just got done with Chapter 8 from Beginning IPhone Development which talked about table views. Table views let you organize things in hierarchical fashion for easy searching. By the end of the chapter I'd created something similar to a contact list or song list where you can search or index through a bunch of items. I'll upload the source code and post some pictures when I get a chance.
Chapter 4 of Beginning IPhone Development. I finished a few other tutorials that taught some simple concepts and I've uploaded the source code. One of the cooler things I messed around with was the auto rotation. For simple things, you can have the IPhone do most of the work in figuring out how to change your application when you rotate it. Or you can just design seperate interfaces for different orientations.
Thursday, February 5, 2009
at
2:25 PM
|
I started doing a simple Picker application based on a tutorial from this book. What I like about this tutorial is that it outlines the basics of everything I need to do even though the tutorial is several chapters into the book. This book seems to really be reinforcing the principles that people should have when developing. The most important/most basic I think so far is to keep the Model/View/Controller design philosophy in mind. The tutorial guides you through making 5 different tabs, each tab has it's own view so each tab will also have it's own controller. Thats pretty straight forward.
Here are some pictures from this tutorial:
It's been a hectic few weeks trying to get my SDK sea legs underneath me but I think I'm off to a decent start. Here's a summary of the things I've learned so far to help my curriculum design go a little easier:
- Introduction to the SDK
- Model View Controller
- I really like this book so far
- Seperate the model, view, and controller.
- Think of the model as the SDK itself, tying everything together.
- The view is what you make in the interface builder.
- The controller is what you code in Xcode
- Simple View Based --> One view, one controller (HelloWorld, ControlFun, TempConverter)
- Connecting things --> Page 48
- Multiple View Based --> Tab Bars, multiple views, multiple controllers (Picker)
I'll try and post more later.
Tuesday, February 3, 2009
at
9:05 PM
|
I'm working on a tutorial from the IPhone Development book I posted a link too. I came across something that I hadn't seen before.
- (NSInteger) pickerView: (UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { return [pickerData count]; }
At first, I wasn't sure what this meant so I did a little research. It looks like it has two method names. It sort of does. This is how you pass multiple parameters to a method in Objective-C. The method is pickerView:numberOfRowsInComponent and it takes as parameters (UIPickerView *)pickerView and (NSInteger) component and returns an integer.
Monday, February 2, 2009
at
8:28 PM
|
The SDK has several templates to help make some of the coding/linking up easier. I know I've rehashed these first two tutorials a dozen times but I 'm going to do it again using templates.
For a simple view you can use a view based template. Create a view based template project and you'll be presented with many things already set up. The code is similar to the code from the first tutorial except you're given more to start with. Also in the interface builder you don't have to link up as much. All you have to do is link the things you put on the view to the files owner. I tried figuring out the Tab Bar template and could not. I think for now I'll stick to making these from scratch as it will help enforce some good programming practices.
Check out this book by the way, I like it so far.
I came up with an idea for a great IPhone application. When I go running I like to run to music that matches my pace. I thought it would be really cool to have an application that could do that. The way I thought it would work would be to use the accelerometer to calculate your pace and then pick a song from the library to use based on that. I did some research and stumbled upon SynchStep which is a program that does pretty much exactly that.
I did learn some interesting things however from emailing Greg Elliot, the developer. The IPhone has a few limitations. One of them is that you can't access other applications from an application you develop, including the music library on your phone. To get around this, Greg didn't use the IPhone SDK and the program only runs on jailbroken IPhones. Really cool stuff but for now I'm just looking at the IPhone SDK for starters. He did direct me to a good resource, Erica Sadun's, The IPhone Developer's Cookbook. I'm going to get my hands on this and go through it and see what it has to offer.
Sunday, February 1, 2009
at
5:50 PM
|
There are several different ways of constructing a lot of this simple GUI based apps. I'm trying to come up with a standard way to do certain ones of the same kind. Here are the steps I've followed to make a Tab Bar Controller.
1) Write the code first (I followed this tutorial) 2) In the GUI, drag a Tab Bar Controller item 3) Add views 4) Make a connection from Tab Bar Controller (New Referencing Outlet) to the Tab Bar App Delegate 5) Make a connection from the Outlets (In the Tab Bar Delegate connections) to the physical on screen items 6) For each on screen item, make sure it's Outlet delegate is the Tab Bar delegate.
That should be it.
|
|