Thursday, April 23, 2009 at 10:17 PM | 0 comments  
Here's an article I found on CVS.

CVS
Posted by JP
Monday, April 13, 2009 at 11:59 PM | 0 comments  
Sample Curriculum 3 was revised a little bit.

Here's version 4.
Posted by JP
Wednesday, April 8, 2009 at 10:12 PM | 0 comments  
My third attempt at a curriculum is up.

Here
Posted by JP
Monday, March 30, 2009 at 1:32 PM | 0 comments  
If you want to do web stuff on your IPhone, like getting files from somewhere, use NSURL

Reference

Here's a document on URL loading for http downloading.

Here
Posted by JP
Thursday, March 26, 2009 at 1:34 PM | 0 comments  
Posted by JP
Wednesday, March 25, 2009 at 5:32 PM | 0 comments  
Take a look at what there is so far:
Video 1
Posted by JP
Tuesday, March 24, 2009 at 10:39 PM | 0 comments  
For someone whose first language isn't Objective-C, it's also good to know the difference between forward declarations (using @class) and #import

Tutorial
Posted by JP
A lot of Objective-C you can pick up as you go along doing IPhone development, but there are several things that are a lot different than in other languages like java.

Check out a tutorial here:
Tutorial
Posted by JP
For my current project I needed a way to add a navigation bar to a tab bar. I know how to do a tab bar by itself and a navigation bar by itself and wasn't sure how to do them together. I stumbled across a video on the iphone development forums that cleared things up a bit.

Click Here for Video
Posted by JP
Thursday, March 19, 2009 at 2:36 PM | 0 comments  
New Features!

Check out some of the new features in the new SDK. One that I'm very excited about is the ability to access your IPhone music library which means we can have apps that do things like play songs depending on your running tempo, or even have power hour plugins.
Posted by JP
Wednesday, March 18, 2009 at 11:57 AM | 0 comments  
Here's my first attempt that putting a curriculum together:

Sample Curriculum 1

I. Introduction to IPhone Development

a. Getting Started (page 2)
1) Intel based Mac running Leopard
2) IPhone SDK
3) IPhone

b. Objective-C (page 5)
1) Pick it up as you go along
2) Objective-C resources

c. Limitations of the IPhone (page 6)
1) What you can and cannot do
2) Important programming practices

d. Setting up a project (page 11)
1) Tour of the development environment
2) Interface builder

II. Model View Controller Paradigm

a. Introduction to MVC (page 30)

b. Basic User Interaction (page 31)
1) Chapter Tutorial

c. More User Interaction (page 53)
1) Chapter Tutorial

d. Multiview Applications (page 113)
1) Chapter Tutorial

e. Tab Bars (page 139)
1) Chapter Tutorial

* Temperature Conversion Assignment

f. Table Views (page 185)
1) Chapter Tutorial

g. Navigation Bar (page 231)
1) Chapter Tutorial

III. Data Persistence

a. Application Settings (page 303)
1) Chapter Tutorial

b. Basic Data Persistence (page 329)
1) Plist Tutorial
2) Archiving Tutorial
3) SQLite Tutorial

IV. Features

a. Animation (page 361)
1) Quartz Tutorial
2) OpenGL Tutorial

b. Accelerometer (page 441)
1) Tutorial

*Etch-a-Sketch Assignment

c. GPS (page 429)
1) Tutorial

d. Camera (page 463)
1) Tutorial

e. Autorotation and Autosizing (page 89)
1) Tutorial

f. Taps, Touches, and Gestures (page 401)
1) Tutorial

*Final Project

V. The Development Process

a. Planning your Application

b. Application Tuning

c. Application Testing

d. Application Publishing
Posted by JP
Monday, March 2, 2009 at 3:16 PM | 0 comments  
Here are some tips I picked up while trying to create some of my own projects.

1) To access the application delegate class do this:

YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate];

Then you can access objects from that class.

2) When using TextFields/TextViews you'll want to conform to the UITextFieldDelegate and UITextViewDelegate protocols. That way when you are done typing in either field you can hide the keyboard with the following code:

-(BOOL)textFieldShouldReturn:(UITextField *)theTextField
{
  if(theTextField == textField)
  {
     [textField resignFirstResponder];
  }
  return YES;
}

-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
  if([text isEqualToString:@"\n"])
  {
    [self.textView resignFirstResponder];
    return NO;
  }
  return YES;
}

3) It's possible to detect when a tab bar controller switches tabs. This is done by specifying a delegate of the tab bar controller, similar to specifying the delegate of the text field. Implement the tab bar controller delegate protocol. Set an object that you want to be the delegate for the tab bar controller, and in that class implement this method:

(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
Posted by JP
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
Tuesday, February 17, 2009 at 2:34 PM | 0 comments  
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
Posted by JP
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.
Posted by JP
Wednesday, February 11, 2009 at 11:57 PM | 0 comments  
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.
Posted by JP
Sunday, February 8, 2009 at 10:25 PM | 0 comments  
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.
Posted by JP
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.
Posted by JP
Thursday, February 5, 2009 at 2:25 PM | 0 comments  
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:







Posted by JP
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:



  1. Introduction to the SDK
  2. 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.
Posted by JP
Tuesday, February 3, 2009 at 9:05 PM | 0 comments  
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.
Posted by JP
Monday, February 2, 2009 at 8:28 PM | 0 comments  
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.
Posted by JP
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.
Posted by JP
Sunday, February 1, 2009 at 5:50 PM | 0 comments  
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.
Posted by JP
Thursday, January 29, 2009 at 3:37 PM | 0 comments  
I started reading the development guide available on Apple's development center website. It outlines some of the basics that you should know about developing an application. This post will serve as basically a bookmark for pages I think are important.

  • Page 11, lists the "Essential Development Tasks"
  • Page 15, "Accessing Documentation"
  • Page 18,49, "Measuring Performance"
  • Page 19, "Hello World"
  • Page 26, "Building Your Application"
  • Page 31, "Using the Simulator"
  • Page 35, "Preparing Devices for Development"
  • Page 45, "Debugging"
  • Page 51, "Testing"
  • Page 55, "Conditional Compiling"
That's all for now.
Posted by JP
Wednesday, January 28, 2009 at 11:18 AM | 0 comments  
I made a small program the other day to convert Fahrenheit to Celsius and back. It's a simple program not requiring many lines of code at all but it took me awhile to write for some reason. I'm still getting used to the Objective-C syntax and all of the different connections that need to be made in order to get things to work. Eventually it will all sort itself out I suppose. Also, I'm back working on the virtual machine and it's really slow so I can't work as fast as I'd like to. Here are some pictures of what I was working on.








Posted by JP
Sunday, January 25, 2009 at 5:41 PM | 0 comments  
Now I'd like to explore a little bit more of the basics and create another simple application. This application is from a tutorial I just read with a few modifications for things that I thought were a little bit confusing. This application involves the simple use of a Model-View-Controller methodology. The model is mostly taken care of by the framework itself, so this focuses on the controller and the view. Let's create the view first.

First open up XCode and create a new Window-Based project. Call it whatever you like, I called mine HelloUniverse2. The first thing we are going to create is a view. An IPhone application has only one window (MainWindow.xib) and to see additional views you must add them as subviews to the main window. Double click on MainWindow.xib to open the Interface Builder.

Depending on how things are set up you might see a few different things. What you should definitely see is a window that says MainWindow.xib. There are four objects in that window, File's Owner, First Responder, something that involves the name of your project, and Window. File's Owner and First Responder we will probably learn more about later, but from what I understand, they are "proxy objects" which apparently means they are a bridge between the nib file (the user interface we create) and the application (the code we write).

For now, let's make a new view. To do that go to File --> New and choose View. A new window similar to the previous one will pop-up but instead of four items it will have three and one of them is View. You can save this view. I saved it as HelloView like in the tutorial I followed. You should probably save the file somewhere in your project folder. You'll be given the choice to add it to your project which you obviously want to do. Then you'll be brought back to XCode where you should drag the file into your resources folder.

Go back to the Interface Builder so that we can decorate our view. Go to Tools --> Library so we can see all of the available goodies. Let's get a label, two text fields, and a button and drag them onto the View. Now we can change some of the properties of our items using the Inspector window. If the Inspector window isn't already showing up go to Tools-->Inspector. The tools menu lists four inspector types underneath Inspector. These correspond to the four tabbed buttons in the main Inspector window. They are attributes, connections, size, and identity.

Let's mess around with the first text field first. Click the text field on the View and go to the Attribute Inspector (Tools --> Attribute Inspector or click the first tab button in the Inspector window). For Placeholder, type First Name. Make sure Clear When Editing Begins is checked. Under Text Input Traits, select Words for Capitalize and Name Phone Pad for Type. Repeat the same thing for the second text field except call the Placeholder, Last Name. Then double click on the button and type something clever. Save the view (File-->Save) and we're done here for now.

We've made the view, now we have to make the controller. Luckily most of the work is done behind the scenes so we are going to just make a subclass of an existing controller. To do this go to File --> New File and in Cocoa Touch Classes we are going to select UIViewController subclass. This is an example of inheritance. UIViewController is a method provided by the Cocoa framework to handle most of the things we need to do. We are going to build upon the functionality of the UIViewController without reinventing the wheel so to speak.

Go to the header file (.h) for the file that you just created. Mine is HelloViewController.h. In here we are going to create variables to link the view to the controller. Make your header file look like the one in the image. The line beginning with @interface specifies the name of our class as a subclass of UIViewController. is a protocol which we will need later to make the textfield behave properly. The lines starting with IBOutlet declare variables for the items that we set up in the Interface Builder. IBOutlet means that it is accessible in the Interface Builder. NSString creates string objects for the text that we will pull from the text fields. We also set some properties for the variables that we created. Nonatomic seems to be what we'll use most and should be like that for most applications. Retain means that the object will retain its value on assignment. I believe copy means that it will create a copy of this object on assignment but I'm not sure. The final declaration is a method for handling the button press. IBAction lets us see this method in the Interface Builder. The name of the function is displayMessage and it takes an id object as a parameter.

Now that we've created the header file we get to provide implementation for it just as we would in C++. So open up the .m file and look at this source code (too much code for an image). To initialize our variables we use the @synthesize keyword. Now we are going to provide the implementation for the displayMessage method. The idea is that when the user clicks the button we want the label to show whatever it was that was in the textfields. The code itself is pretty self-explanatory give or take some syntax. Remember, there is no garbage collection so we have to manage our own memory to avoid leaks. We also create a textFieldShouldReturn method. This is why we used to allow us to write this method. This method says that if the textfield is one of ours that we created, when we press return, we should give up control of it. Without this, the typing pad will stay open.

We're not done yet. We still have to add the view we just made to the main view. To do that go to the AppDelegate.h file and add a variable declaration for HelloViewController. Then in the .m file we need to actually provide the implementation to link the view with the main window. Once again, the code is pretty self-explanatory except for the syntax. We're using a bundle. I'm not too sure what it means but perhaps I'll figure it out later.

That's all of the code that we have to write. We still have to link up all of the visual items with their variable names that we've given them. To do this, we go back into the Interface Builder. Click on the File's Owner so the Hello View Inspector appears and click on the Identity tab (the i button on the top right of the Inspector window) and select HelloViewController for the class. We've now connected the view controller to the proxy object. Now we must connect the view to the view controller. While still having File's Owner selected, click on the Connection Inspector (the arrow button) and drag the circle next to the view variable to the actual view. Also drag the circles for our textfields and label and buttons to the ones on screen. And that's it, we should be done. Save your work and go back to XCode, compile and run, and you should have a working app!

Posted by JP
I finally was able to create my first working application! Whenever anyone starts a new programming language the first program they inevitably create is Hello World. So that's what we're going to do.

To start off, first open up XCode and close the welcome screen that pops up. Then select File-->New Project and select Window-Based Application. You will be greeted with the XCode IDE. There are some files in there that contain some code and stuff. I'm not quite sure what a lot of that means yet but I'm sure I'll figure it out as I go along. The file of interest is MainWindow.xib. This seems to be the main window of the application. Double clicking this file opens the Interface Builder where we can design a user interface.

What we want to do is go to the Tools menu and select Library. There are a lot of user interface objects that are here. For this simple program all we need is a label. Go the library and find Label and drag one out to the window. Then double click on the label and type "Hello World." Save your work at this point. Now go back into XCode and hit Build and Go at the top of the screen. The IPhone simulator should pop up and you should see "Hello World" pop up in the window. Congratulations! We just made our first application! Now it's time to find something more fun to do.
Posted by JP
After several hiccups with my VMWare setup, I was finally able to get up and running. Ideally I'd be working on an actual Mac but for now this will have to do.

The first thing I did was head over to the IPhone Development Center and watch some of the Getting Started videos. These first several videos that I watched give a basic overview of all of the features contained in the IPhone SDK as well as the IPhone. The IPhone SDK contains a number of useful tools like XCode, Dashcode, and Instruments. These tools are what you will be using when developing your own applications. The IPhone itself is comprised of four parts divided into layers. There's the Core OS which handles all of the chores an operating system would be expected to do. On top of that, is the Core Services layer which comprises all of the services that all applications must interact with. On top of that is the Media layer which is where your application can interfacec with the audio and graphical capabilities of the IPhone. Finally on top of that is the Cocoa Touch framework where all our development gets done. The Cocoa Touch framework has a ton of function available for us to use.

The API is written in Objective-C which is a superset of ANSI C with some additional syntax to make it object oriented. Another cool thing that I discovered was that you could mix C++ code with your Objective-C. When developing applications it seems very important to be consistent and stick to appropriate conventions. The Model View Controller model is an essential part of the development.

This was meant to be a brief overview of some of the things I learned today from watching these introduction videos. I recommend watching them yourself as well. Hopefully now I can start making some applications!
Posted by JP
Saturday, January 24, 2009 at 4:06 PM | 0 comments  
After getting my hard drive and installing OS X to it I realized that you can only then boot to that hard drive from a Mac machine. So at this point my only option was to use a virtual machine again. Curiously, this time around, the virtual machine was much more responsive. Hopefully that means I will be able to develop on it very shortly.
Posted by JP
Thursday, January 22, 2009 at 7:16 PM | 0 comments  
I was able to borrow an iBook running Leopard from the CS department. I downloaded the IPhone SDK and attempted to install it. I noticed then of course that the IPhone SDK will only install on Intel-Macs. Since the iBook is a PowerPC-Mac I could not install the SDK. I guess I'll just have to wait for my hard drive to come.
Posted by JP
Saturday, January 17, 2009 at 1:06 PM | 0 comments  
Using VMWare to run OS X, while incredibly cool, is incredibly slow. Instead I'm going to try and install Leopard on an external hard drive and boot off of it directly. While I'm waiting for my drive to get here, I'll redesign some of the blog and start reading up on my Objective-C.
Posted by JP
Friday, January 16, 2009 at 12:19 PM | 0 comments  
Gotta love virtual machines. Seeing as I don't own a Mac and it's really no fun to try and develop applications on a computer that doesn't belong to you, I did the next best thing, run a virtual machine! VMWare allows one to run "virtual operating systems" so you can still run Windows but in another window have a whole other operating system running. In this case the other OS was Mac OS X 10.5.5 which is required to run the IPhone SDK.

The virtual machine is a bit slow but we'll see how things go. I may just cave and go use a computer in the computer lab.
Posted by JP
Thursday, January 15, 2009 at 1:29 PM | 0 comments  
I've got my blog set up. I aim to document the work I do for my independent study here, on this blog. Let's get to work!

The first thing I did was head on over to the IPhone Dev Center to download the IPhone SDK. The IPhone Dev Center seems to contain everything anyone would ever want to know about developing applications. First things first. I downloaded the Free IPhone SDK and realized that it is for Macs only. The IPhone OS as well as OS X (and thus the sdk and all the iphone apps) are written in objective-C which is why there is no Windows version.

So for now, it's off to find a Mac!
Posted by JP