Project Learn to Program on the iPhone progresses

By sylvie | November 27, 2009

It’s a slow process but I am definitely learning by working on my toy application. I had hit a snag in that, while I could get my first screen to display (the one containing a list of all the vanity pets in WoW), I could not get the detailed view to open (that is, if the person hit the “reveal more” button, nothing happened). Sarah looked at my code and, while she couldn’t find the solution, she did put me on the right track: I was having a problem with the concept of navigation control.

This morning I reread the chapter on navigation and realized that I had been doing the contrary of what needed to be done. I was trying to declare my child controller instead of the root controller in the app delegate. Once I changed that and added the correct nib name in the program (and cleaned up all the crud we had plugged in trying to figure out what was going on), my program was able to open up a second window. It also automatically added a top navigation bar, which is great for my second window, but which I would be happy to lose on my main window. However I will leave it there for now as it does give me a free title bar.

Now I can start working on the interactions. I want my user to be able to do two different things:

  1. Be able to indicate whether the user has or not a particular pet
  2. Be able to indicate whether the user wants to remove a particular pet from the list

The first interaction is obvious and needs no elaboration. I was going to try to use the iPhone’s toggle switch, but its two choices are “On” and “Off”, which aren’t appropriate. And while I have found an example of someone changing the text to “Yes” and “No”, I cannot get it to work in my code. Probably because they’re doing the creation of the switch programmatically while I’ve hard-wired it into my user interface. So I’m just going to use a button that the person can press to toggle their answer between “Yes” and “No”.

The second interaction is one that is already available in the WarcraftPets.com site but which I hadn’t originally thought to include in my program. The ability to remove a pet is there because there are some pets which people either cannot or will not try to acquire. For example, there was a cute little Chinese-style dragon that was given out during the Olympics in Beijing. It was only available to people who logged on during the Olympics, so if you weren’t online at that time, you can never have that pet. So the user might want to flag the pets that he/she wants to ignore.

There are two ways I could handle this. One would be to let the pet appear in the global list, but add an appropriate tag (e.g., “exclude” or “ignore”). The other would be to remove the pet from the global list and present it on a separate page (”excluded pets”). Personally, I am leaning towards the first solution if only because it would make my life simpler.

I think I will stick to the first solution for now. Once I have finished this, I might think about re-doing the whole exercise, but this time letting people select from four different views: all of the pets, only the pets you have, only the pets you are looking for, and only the pets you have excluded.

Topics: Programming, Project Smartphone |

Comments

Archives

Mascot

Twitter

Blogroll