Appendix B. 31 Days of iPhone Apps

Over the years, we have given many presentations on developing mobile applications. One thing we have heard time and time again is that people have a hard time taking those first steps to write their first iPhone application. It's easy to think that it will take too much time or be too hard, but that is simply not the case. But instead of telling people this, we decided we would show them how easy it really is. And with that, Apps Amuck was born.

One of our first goals was to write 31 iPhone applications in 31 days. By doing so we thought we could prove to everyone that it's not as hard as they might have first thought to create an iPhone app. The month just flew by, and before we knew it, we were done. All 31 apps were completed in record time.

This was a tough challenge, and we really had to push ourselves to accomplish our goal. Along the way we learned a lot, and we know from all the e-mails we've received that many of you have, as well. What follows are the 31 applications that we created. For each app we have included a description, technical details, a source code link, and the splash screen image.

We hope that with all of these applications—and with this book—you will learn even more and go even further in your goals for iPhone game development.

Day 1: Minutes to Midnight

Minutes to Midnight counts down the minutes from the current time until 12 a.m. This simple-to-use application is particularly helpful to anyone who must meet a deadline before the day is over. We created this first application on Friday, October 1, 2008, the very first day that Apple released the NDA that was preventing developers from discussing and sharing code. We have always been proud of being there for iPhone developers since that very first day. For the first app we noticed that the iPhone had a digital-looking font available on it, and decided we could create an iPhone clock around that easily enough. From there we created the clock application. It worked well and gave us a chance to share the code and knowledge with other developers.

Minutes to Midnight covers working with fonts and how to use timers. You can also learn how to access the current date and time on the device.

Tip

You can find the source code for Minutes to Midnight at http://appsamuck.com/day1.html.

Day 1: Minutes to Midnight

Day 2: Bonfire

With day 2 we decided to heat things up and created our Bonfire application, which gives you an instant campfire on your phone. The campfire is not just an image, but a video on a loop. The loop allows the flames to be shown as realistically as possible. The loop also keeps the video of the flames from pausing, thus making it appear more realistic. This application has many uses. It is stronger than an ordinary flame when it appears on the screen. Also, its infinite loop allows it to last longer than a regular match or even candles. And finally, it's great for concert-goers who would love to hold up a flame at a concert but don't want to carry matches or a lighter.

This app teaches developers how to create animations and work with lots of images.

Tip

You can find the source code for Bonfire at http://appsamuck.com/day2.html.

Day 2: Bonfire

Day 3: openURL

openURL helps you launch Maps, SMS, Browser, Phone, and other applications. A developer can look at the source code and learn everything he wants to know about opening URLs on the iPhone. openURL's purpose in life is to open other applications for people. It is the butler of applications, if you will. If you need to make a call, it will open the Phone Dialer application. If you need to see a Web site, it will open Safari on the iPhone, and so on.

This is a great application for developers since it shows them how to do common features like make a phone call, send a text message, or send an e-mail. Many applications could be improved easily by adding this kind of functionality to them.

Tip

You can find the source code for openURL at http://appsamuck.com/day3.html.

Day 3: openURL

Day 4: What Is My IP?

Have you ever had trouble finding what IP address your phone is using? You may work with a friend or family member and typically you would have them use IPConfig or a Web site to return the IP address. However, it's not that simple on the iPhone. With the What Is My IP? application, you can get an IP address with ease. At some point, many developers find themselves needing to know the IP address of the machine they are working on. We ran into this problem around day 3 and decided to write an application for it.

This is a very focused application that does only one thing, but it does that one thing well: It provides developers with the code needed to get the IP address of the device their application is running on.

Note

You can find the source code for What Is My IP? at http://appsamuck.com/day4.html.

Day 4: What Is My IP?

Day 5: Count Me In

Count Me In gives you a new take on an old problem—making sure you don't lose count. This easy-to-use, digital counting application has an uncluttered interface that shows a single window with your count tally. Ergonomically sized tally buttons are a great feature. The green button adds another count while the red button subtracts. This useful app is great for coaching and sports, perfect for doing inventories of all kinds, and handy whenever you need to focus your concentration on more than one thing at a time. It works for quick counts and long-term tallies, so if you really need to make sure all the kids got back on the bus or simply want to keep track of how many pizzas you've ordered out this year, Count Me In is your solution.

Count Me In covers utility applications, awakeFromNib, UIButtons, UILabels, UIImageViews, and more.

Tip

You can find the source code for Count Me In at http://appsamuck.com/day5.html.

Day 5: Count Me In

Day 6: Reaction Time

Simple reaction time is usually defined as the time required for an observer to detect the presence of a stimulus. For example, an observer might be asked to press a button as soon as a light turns on or a sound is made. Mean reaction time is approximately 180 to 200 milliseconds to detect visual stimuli. Do you know yours? Reaction Time is a fun little application that attempts to measure your reaction time. It is loosely based around one of the ultimate measures of reaction times: the drag race. There is a traffic light that changes from red to yellow to green, and then it kicks off a timer. As soon as racers see the green they need to press the accelerator pedal.

Reaction Time covers utility applications, awakeFromNib, UIButtons, UIImageViews, and more.

Tip

You can find the source code for Reaction Time at http://appsamuck.com/day6.html.

Day 6: Reaction Time

Day 7: Speed Dial

Speed Dial is one of the most useful things you can use on your phone. Instead of having to go through your contacts to find people you call frequently, putting them on speed dial makes it extremely easy to reach them. It makes multitasking easier as well—you simply press a button to dial while you do something else. Speed dial is extremely easy to set up. Most phones come with a 99-number speed dial capacity.

If there is one thing the iPhone is, it's a phone. It even has phone as the main part of its name. That being said, we thought it would be important to cover how to have your application use the iPhone as a phone.

Speed Dial covers creating settings bundles, reading and writing user settings, and more.

Tip

You can find the source code for Speed Dial at http://appsamuck.com/day7.html.

Day 7: Speed Dial

Day 8: Flickr KML

Do you have great pictures on your Flickr account that you think should be uploaded to Google Maps? Try Flickr KML, a cool iPhone app that lets you upload the pictures straight to the Google Maps application. For every photo you upload, a pushpin appears on the map to show recently geo-tagged images on Flickr. It's a great feature that you can experience in the Map application on the iPhone. The animation that goes along with each pushpin really takes this feature over the top. KML is underused by the developer community, so we decided to create an app for it.

You can learn how to have code run before your application really begins by using the awakeFromNib event. Find out how to use UIButtons, UIImageViews, and more. Learn more about utility applications for iPhone with Xcode, and find out how you can call Google Maps from your application.

Tip

You can find the source code for Flickr KML at http://appsamuck.com/day8.html.

Day 8: Flickr KML

Day 9: Snow Fall

If you're looking for an application that will spread seasonal cheer, Snow Fall is for you. This application uses the image of a single snowflake and repeats it on the screen as multiple flakes falling down the screen. It's a great app if you're experiencing winter-weather withdrawal or if you just love to watch the snow fall. The beautiful white-and-blue design of this app will remind users of winter all year long. We started the 31 days of iPhone applications in October, and while it had not snowed yet, it was starting to get cold, and all the stores were displaying Christmas-related goods. We came up with the idea of creating a virtual snow shower, and from there we created Snow Fall.

You learn how to use Quartz animations in your animations, timers, random number generators, and more. You also learn more about utility applications for iPhone with Xcode.

Tip

You can find the source code for Snow Fall at http://appsamuck.com/day9.html.

Day 9: Snow Fall

Day 10: Where Am I?

Are you an avid hiker, backpacker, back-country explorer, or just simply an adventurer? Have you ever been stranded in a remote location and needed to communicate your exact location in order to be rescued? Ever been walking down the street and wondered, "Hmm, I wonder what my exact location is at this very moment?" The Where Am I? application uses the GPS device in your iPhone to pinpoint your latitude, longitude, and even altitude. Some developers tend to seek out the hardware features of their devices. It was not long before we did the same. Both the GPS and the accelerometer are exciting features of the iPhone. We wanted to learn more about them, and by the end of the day we had created the Where Am I? application.

You learn how to use GPS to access longitude, latitude, and altitude. Learn about UIButtons and UIImageViews and how to access the hardware capabilities of the iPhone in your app.

Tip

You can find the source code for Where Am I? at http://appsamuck.com/day10.html.

Day 10: Where Am I?

Day 11: Plumb Bob

The Plumb Bob application helps ensure straightness in carpentry, masonry, and other jobs or projects. The Plumb Bob is a plummet, or weight, that is suspended by a string and used to check that lines are vertical. The application must be turned on and then lined up with the object in question. If the string on the iPhone is straight, it ensures that the object is straight. If the object is not straight, the application shows that. We like that the iPhone has replaced many other common devices that people tend to carry around with them, such as calculators, notepads, and cameras. But what other tools could we replace with an iPhone application? That's why we created a virtual plumb bob.

This application teaches the basics of working with the accelerometer. The code also uses UIImages, UIImageViews, rotation transforms, and more.

Tip

You can find the source code for Plumb Bob at http://appsamuck.com/day11.html.

Day 11: Plumb Bob

Day 12: U Decide

If you have trouble making decisions or finding the right answers to questions, you'll love the U Decide application. It has an easy-to-use interface, and responses are clearly shown at the top of the iPhone screen. This app handles simple decisions that involve answers of yes/no, true/false, and others; but it's also capable of helping users decide between more complicated options. For example, a user can select that the answer be a number from 1 to 100 or a buy/sell/hold decision. Other options include A/B/C/D responses, left/right/center responses, and more.

The biggest focus of U Decide is creating and working with random numbers. All decisions are made using randomly generated numbers. There are also a lot of IBActions, UIButtons, UILabels, and more.

Tip

You can find the source code for U Decide at http://appsamuck.com/day12.html.

Day 12: U Decide

Day 13: My Google

Enjoy the Google application on your iPhone without the navigation bar or toolbar. Google can come in handy to help you search for anything you may need to know. The entire purpose of the My Google application is to show developers that their native iPhone applications can hold a Web page inside them without opening a separate instance of Safari. This can be very powerful; because only one application can run at a time on the iPhone, being able to show a Web site or HTML and not close your application is a great win.

This application teaches you how to host Web sites and HTML inside your application. You also learn how to enable user interaction for your application.

Tip

You can find the source code for My Google at http://appsamuck.com/day13.html.

Day 13: My Google

Day 14: Sleep Sound

The Sleep Sound application generates calming sounds that gently lull you to sleep. It's also ideal for meditation or for those times when you need to let the stress melt away. One of the best features of the Sleep Sound generator is that it goes everywhere with you—it's as close by as your iPhone. You'll find Sleep Sound simple to use right from the moment it's downloaded. We wanted an application that showcased the audio capabilities of the iPhone. We knew we wanted a sound-effect application of some kind, but we weren't sure about coming up with the sounds in such a short amount of time. Finally we decided on creating a lullaby-type application that would help users sleep, something we were always looking forward to by the end of the day.

The highlight of this application is learning how to loop background sounds. There is also code to work with UIImageViews and UIButtons.

Tip

You can find the source code for Sleep Sound at http://appsamuck.com/day14.html.

Day 14: Sleep Sound

Day 15: ZipWeather

Enter a ZIP code, and ZipWeather gives you a weather forecast for that location. The current conditions, the forecast for the following days with highs and lows, and a link to the Yahoo! weather site are all provided. This is a reliable application because all information is provided by the Weather Channel. The fact that forecasts are looked up by ZIP code means you can find weather forecasts for locations before arriving at your destination, giving you more time to prepare for the weather you may face. ZipWeather is sure to be a useful application for almost any iPhone user.

One reason we decided to create a weather-related application was to show people how to pull data off the Internet and interact with it. The key topic featured in this tutorial is the basics of downloading data with NSURLConnection. We also cover how to use UIWebViews.

Tip

You can find the source code for ZipWeather at http://appsamuck.com/day15.html.

Day 15: ZipWeather

Day 16: World Tour

World Tour lets you know exactly when the iPhone Tech Talk World Tour will be in your area. This app keeps you up to date on the tour and allows you to view the stops that the tour will be taking, so you won't miss out. We wanted to create an app about the iPhone Tech Talk World Tour to help spread the word about all the great events Apple does to help developers learn more about programming the iPhone.

We cover lots of good stuff in this tutorial, including opacity with images, using rotation transformations, tiling images, and creating animated wallpapers. We also discuss how to play sounds in a loop.

Tip

You can find the source code for World Tour at http://appsamuck.com/day16.html.

Day 16: World Tour

Day 17: Fireball

The Fireball application acts like a screensaver for the iPhone. The screensaver appears as an orange ball of fire floating against a black background, leaving a trail of gray balls in its path. You can use this screensaver to entertain others and show off another neat application. We would have been remiss if we did not cover a bouncing-ball type of demo at some point. But instead of a bouncing ball we did a ricocheting fireball. It's lots of fun, and nobody gets hurt.

This application has a strong focus in using UIImageViews and UIImages. Again, we took advantage of semitransparent images. This tutorial covers the basics of creating a particle emitter and how to use setAnimationDidStopSelector to remove an animation.

Tip

You can find the source code for Fireball at http://appsamuck.com/day17.html.

Day 17: Fireball

Day 18: Homeland Security

The Homeland Security application acts as an official alert to any Homeland Security advisories. The app appears as a blue screen with the Homeland Security Advisory System heading. Below the heading are five levels of risk of terrorist attacks. The current risk level is highlighted. This application helps you stay aware of any changes in the risk of terrorist attacks, or use it as an interesting conversation starter between family and friends. This is another application that uses information on the Internet to decide what it should show.

Homeland Security is a great application to learn the fundamentals of downloading data using NSURLConnection. You can also find out more about UIImageViews and working with semitransparent images.

Tip

You can find the source code for Homeland Security at http://appsamuck.com/day18.html.

Day 18: Homeland Security

Day 19: Altimeter

If you are a hiker, biker, skier, snowboarder, or climber, you may want to download the Altimeter application. It's important to know your altitude level because it affects oxygen saturation. Anything over 8,000 feet can be dangerous. With this app you can carry your iPhone with you and always know how high up you are. Everyone seemed to be focusing on the latitude and longitude aspects of the iPhone's built-in GPS. But it can also do altitude. We decided we would create an application that did nothing more than find the altitude to try to promote this feature a little more.

Altimeter is a great application to learn more about working with the iPhone's GPS hardware, and it's a great source for finding out more about utility applications.

Tip

You can find the source code for Altimeter at http://appsamuck.com/day19.html.

Day 19: Altimeter

Day 20: Temperature Converter

Memorizing conversion factors is tedious. Even if you memorize the equations to convert degrees, it's difficult to do without a calculator. You may not always have the necessary tools to convert temperatures. With the Temperature Converter application, simply enter the temperature in Fahrenheit, Celsius, or Kelvin degrees. The iPhone then shows you how many degrees that would be in the other systems of measuring degrees. It's a great tool for those interested in weather or traveling abroad and using other measurements of temperature. We noticed that the iPhone had some great hardware features but it didn't have a thermometer. That didn't stop us from creating a thermometer-focused application.

This application explores performing numeric calculations on data and working with UI controls.

Tip

You can find the source code for Temperature Converter at http://appsamuck.com/day20.html.

Day 20: Temperature Converter

Day 21: iDrum

Do you love music? Do you wish you had a drum but you cannot afford one? This application instantly converts your iPhone into a drum. After purchasing the application, you can play the drums anywhere, anytime. The iDrum application is great for those who want to learn how to play the drums or for those who already know how to. Family and friends will be entertained by the user's musical skills. It's also a fun application to help pass the time! We wanted another audio application and decide to create a virtual drum. It just goes to show you how a simple application can create something special.

This application is about touch and sounds. If you are looking to add either of these to your application, you might want to look into this application.

Tip

You can find the source code for iDrum at http://appsamuck.com/day21.html.

Day 21: iDrum

Day 22: Pumpkin Face

Kids love pumpkins, Halloween, and iPhones, and the Pumpkin Face application puts all of these together. It's a handy tool to help kids see at night while trick or treating, and it's a wonderful theme for autumn. This app also serves as cool wallpaper for your iPhone. Pumpkin Face helps protect your precious toy in style. The app is fun and friendly and spooky, all at the same time. Your kids will love it, and you will love it. It's inexpensive and family-friendly. We created all of these applications in October, so it's no surprise that a little Halloween fun made its way in.

This application is full of animations, UIImageViews, and more.

Tip

You can find the source code for Pumpkin Face at http://appsamuck.com/day22.html.

Day 22: Pumpkin Face

Day 23: Hypno

Hypno is a great optical illusion app that will have you mesmerized by your iPhone in no time. It's a great app to have so you can take it with you wherever you want and show all your friends. Don't get caught looking at Hypno for too long, but make sure you show everyone this great app. It's always fun to play with. This application has a great set of animation spirals that create a mesmerizing optical illusion effect.

Hypno is full of rotating semitransparent images. Each image is randomly sized and placed and each spiral spins at a random speed, creating a fascinating effect.

Tip

You can find the source code for Hypno at http://appsamuck.com/day23.html.

Day 23: Hypno

Day 24: AmuckColors

If you have ever done any HTML design work, you know how hard it can be to find that perfect color. That's where AmuckColors comes in. We can't think of anything handier than something that fits in your pocket and remembers all of those cryptic HTML color codes for you. It's easy to look up color values on the go, with red, green, and blue values and HTML codes written on every swatch. Our goal was to create an application that hosted an image much larger than the display of the iPhone.

This application shows you how to use the UIScrollView to view images larger than the screen. You can also learn more about the UIToolbar.

(Special thanks to Bob Stein at http://visibone.com for permission to use this image.)

Tip

You can find the source code for AmuckColors at http://appsamuck.com/day24.html.

Day 24: AmuckColors

Day 25: Sierpinski

This application allows you to zoom in to one of the most well-known fractals, the Sierpinski triangle. Fractals are infinitely complex sets based on an initial image that is then iterated upon itself, and often presented as two-dimensional. Fractals are always a great way to show off the graphics capabilities of a platform, and the Sierpinski fractal, with its rainbow of colors, is one of the best. The zoom feature uses a mathematical algorithm to continuously redraw the fractal as the levels of magnification intensify. It's a must-have for any fractal, math, art, or programming enthusiast.

This app teaches the user to use UIImageView, Quartz graphics, and the basics of fractal geometry.

Tip

You can find the source code for Sierpinski at http://appsamuck.com/day25.html.

Day 25: Sierpinski

Day 26: LavaFlow

Remember those "gotta have 'em" things from yesteryear—you know, the disco ball, the bell-bottom jeans, and of course, the lava lamps? Well, we thought we'd mix a little bit of that nostalgia in with today's hottest piece of technology, your iPhone. The result is LavaFlow, the grooviest way to chill out, whether you're in your bedroom at home, on the plane waiting to take off, or just lying in a field smelling the daisies. Kids will love watching those blobs of goo rise and fall over and over again, just like we did with our lava lamps years ago.

This application demonstrates how to play a looping video and shows the basics of working with video files.

Tip

You can find the source code for LavaFlow at http://appsamuck.com/day26.html.

Day 26: LavaFlow

Day 27: PhotoFrame

If you don't like the boring, bland framing of the conventional iPhone screen and want to display your photos with the beauty they deserve, you'll want to check out the PhotoFrame application. Using the iPhone screen, PhotoFrame enhances any photo and turns images captured by the iPhone camera into works of art that you can display to your friends and loved ones. PhotoFrame takes the imaging capabilities of the Apple iPhone to the next level. We created this app during the time that everyone was starting to buy digital photo frames for their families for Christmas. We decided we could create an app to do that.

This application takes an image using UIImagePickerController and overlays an image of a frame.

Tip

You can find the source code for PhotoFrame at http://appsamuck.com/day27.html.

Day 27: PhotoFrame

Day 28: DigiClock

DigiClock is a plain-and-simple app that gives you the feel of an old-school alarm clock that you've grown to love over the years. The digital clock is nothing extravagant, just easy to read from any location.

This tutorial covers basic image animation techniques and a touch of transparent images.

Tip

You can find the source code for DigiClock at http://appsamuck.com/day28.html.

Day 28: DigiClock

Day 29: Password Generator

With all the passwords we create today, it's no wonder every developer tries to create the next great password generator. Here is our attempt to do just that. Tell Password Generator whether you want to use numbers, upper- or lowercase letters (or both), and punctuation symbols; specify the length of your desired password; and then touch Generate Password to create a new, completely random password. For extra safety, Password Generator can show the phonetic expansion of your password, reducing the chance that you will mistake a 0 for an o or a number 1 for a lowercase L. Using Password Generator makes it much more difficult for hackers to crack your password-protected account.

In this application you learn about skinning a UIButton and working with many of the built-in iPhone UI controls, and there's content on basic animations and random numbers as well.

Tip

You can find the source code for Password Generator at http://appsamuck.com/day29.html.

Day 29: Password Generator

Day 30: DeathCalc

Just in time for Halloween, we created the DeathCalc, which comes with some bad news: It's designed to tell people the statistically most likely date of their demise. It even calculates your time left in seconds so you can watch them ticking away. This is a fun app that is great to show off and impress your friends with. Everyone will want their information to be entered to see when their time will come. Don't be surprised if you start looking at time in a whole different way!

There is a strong focus on working with UI controls and data calculations in this application, and there's some good material on using strings.

Tip

You can find the source code for DeathCalc at http://appsamuck.com/day30.html.

Day 30: DeathCalc

Day 31: Moolah

Recession? Depression? Forget about it! Feel better about life with this app that rains money on you. If you've always wanted to swim in money—and who hasn't?—Moolah is just what you need. For our final application we wanted to create something with some nice special effects. We decided on Moolah with its screen full of money. Many of us hope we can strike it big with our mobile apps and have the money just rain on us. Have fun with this entertaining app.

This is a full-featured app that was previously rejected by the App Store. It has been resubmitted with the enhancements that are included in this example.

Tip

You can find the source code for Moolah at http://appsamuck.com/day31.html.

Day 31: Moolah
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset