Instructables

My first own iOS app - Gas By Numbers - a gas mileage calculator

Picture of My first own iOS app - Gas By Numbers - a gas mileage calculator
I bought my first iPad 2 years ago. A year later I bought an iPad2 and a little later an iPod touch as my “iPad to go” (it’s just more pocketable).
Having downloaded about 70 apps over time (free and paid apps), I found that some apps are doing exactly what I want, some overfulfill my needs and some just didn’t work as I expected.

But, after 2 years of app consumption, I finally got the idea that I wanted to have apps exactly how I wanted them. So I decided that I want to program an app.
So I challenged my self – as a personal DIY-Project – to learn iPhone programming.

This instructable will show off my finished app “Gas By Numbers” (a gas calculator), it’s functions, how to use it, and how I became an “app-developer” from scratch.

My gas calculator follows the steps I undertake when I fill up my car. First I note down the mileage, then I start refilling my car and already note the gas price while refilling. Finally, I enter the amount of gas I refilled right after hanging up the nozzle of the pump. While I go in to pay my bill, I already know my gas mileage.

The first bullet points will show how to use the app itself (always headed off as App-Step X). Below I will comment on some programming features needed or additional thoughts that went into programming the specific UIView (always headed off with Programming).
I have quoted the “app-developer” because this is my first app and there’s so much more I can learn from here.

To complement this instructable, I especially tweaked my app so I can offer a free download on iTunes with "free Gas By Numbers".
In the free version I have stripped off the data collecting part of my gas calculator, and the calculation of the gas consumption and cost of the daily commute. So the free app actually resembles the program how I initially wanted it to be just for my own use.

Link to the free app:
http://itunes.apple.com/us/app/free-gas-by-numbers-gas-mileage/id550854967?mt=8

Link to the paid app:
http://itunes.apple.com/us/app/gas-by-numbers/id531541048?mt=8

All the other stuff within the paid version came later to mind as I was thinking about distributing my app via iTunes (think about localizing an app for different countries, adding functions that may be interesting for potential users, etc.).

The last step will tell you what you need to start programming for iPhone and some (hopefully useful) hints and tips to start learning programming.
 
Remove these adsRemove these ads by Signing Up
rhylin263 months ago

Thank you for this!

I'm just starting out as a developer, so a step by step on how and why to do things is very appreciated.

Mike73 (author)  rhylin262 months ago
Thanks for your feedback. In the meantime I have quit programming due to different reasons. The main reasons were the hassle with tax preparation (depends on the country you live) and the requirements of the app store with pretty strict guidelines that had to be followed. Besides having a full time job, a 2 hrs daily commute and a family, getting all this crammed into one day was quite intense. But it was a great personal challenge. If you have more questions I can try to help.
pfred22 years ago
I never understood why people calculate their gas mileage. The only time I can imagine it would be of any use would be if your gas gauge is broken. Other than that when you run low you either buy more gas, or don't drive. Knowing how many miles you're getting a gallon doesn't get you another foot down the road.

Today you can't even make the case for engine tune ups. Cars just aren't like that anymore.
Mike73 (author)  pfred22 years ago
Well, I never understood why people need fast cars...
But that's not the point here. I wanted to know how much I pay in average on a per day basis just to go to work and back. So I need to know how much gas my car consumes.
My app is even keeping track of all the data.

I agree that I go and refill my car when I'm running low on gas, but I'm also carpooling so just keeping track of how much I have to pay per month is easiest by tracking the mileage and the price...
...so there you have it. In this case you want to calculate your gas mileage (or gas consumption) ;-)

And this is maybe even more important for people who need to be careful about their spendings.
cool, will you post the source code for this?
Mike73 (author)  amandaghassaei2 years ago
I'm not sure if posting the source code is a good idea. Even if it's a rather small program, the code is quite lengthy.
But if you're interested ...
... now I'm trying to be funny (sorry, I couldn't resist):
and don't just want to change the color of the background and then release it as a competing app,
... funny off
I can try to extract the different classes and pm them to you.
Unfortunately, there are already so many competitors, I wish I would have checked before I started programming ;-)
The interface was made utilizing InterfaceBuilder, so that wouldn't be included in the code (well, to some extend as the app is set up multilingual).

Duuh. I also had forgotten to post the link to the free app. So thanks for your comment. This way I saw it was missing :-)
thanks for the info, if you decide to post it you can attach it to a step the same way you add pictures to a step. If you put it all in a zip file it won't be so much stuff.