Basic Model-View-Controller flow for iOS

So, one important thing to learn in iOS as well as in any language are some core concepts of software design. This would be the model view controller pattern.

In terms of an iOS project, a good way to think of how this could be implemented would be in a calculator application. The model of this project would store the methods that process the number, i.e. a method to add, a method to substract, a method that divides, and a method that multiples, etc.

For the sake of this application, lets assume each of the methods has an input of two doubles and returns a double as well. Essentially, our model will contain all the methods that do any action to the numbers in the calculator.

In our view controller, we will then make an instance of our model class. This will allow us to use all the instance methods we created in our model class in view controller class. Essentially, we want to pass the values from our view into the methods stored in our model.
Here is the header file:


//  CalculatorModel.h
//  ModelCalculator
//  Created by Andrew Rauh on 5/12/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.

#import <Foundation/Foundation.h>

@interface CalculatorModel : NSObject

- (double) addNumbers: (double) numberToAdd1 :(double) numberToAdd2;

- (double) subNumbers: (double) numberToSubtract1 :(double) numberToSubtract2;


And here is the implementation file. (.m)

//  CalculatorModel.m
//  ModelCalculator
//  Created by Andrew Rauh on 5/12/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.

#import "CalculatorModel.h"

@implementation CalculatorModel

- (double) addNumbers: (double) numberToAdd1 :(double) numberToAdd2
    return (numberToAdd1+numberToAdd2);

- (double) subNumbers: (double) numberToSubtract1 :(double) numberToSubtract2
    return numberToSubtract1-numberToSubtract2;


Now, we need to make an instance of this model class in our main view controller. So, do this:

//  ViewController.h
//  ModelCalculator
//  Created by Andrew Rauh on 5/12/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.

#import <UIKit/UIKit.h>
#import "CalculatorModel.h"

@interface ViewController : UIViewController {
    UIButton *button1;
    CalculatorModel *calculatorModel;

@property (nonatomic, strong) UIButton *button1;
@property (nonatomic, retain) CalculatorModel *calculatorModel;


And finally, we will actually use and access these methods in our implementation file.

//  ViewController.m
//  ModelCalculator
//  Created by Andrew Rauh on 5/12/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.

#import "ViewController.h"

@interface ViewController ()


@implementation ViewController
@synthesize button1, calculatorModel;

- (void)viewDidLoad
    [super viewDidLoad];
    calculatorModel = [[CalculatorModel alloc] init];
    //Then you could pass in values from your view into the model methods. 
    //in this case I am just passing two arbitrary values into the method to test it. 
    [calculatorModel addNumbers:3.4455 :5.3];
    NSLog(@"%f",[calculatorModel addNumbers:3.4455 :5.3] );

- (void)viewDidUnload
    [super viewDidUnload];
    // Release any retained subviews of the main view.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);


I realize this is exceptionally simple, but hopefully it showed the basics of this development pattern for iOS!


How to learn to develop iPhone apps.

Many, many people always are curious about how to start developing iPhone and iPad apps. So, here is my guide to how I learned, and hopefully it will help!

First, you need the following:

  1. A fairly recent Apple Computer running Snow Leopard or Lion.
  2. Xcode with the iPhone SDK installed. (Its available in the App Store.)
  3. If you wish to do on device testing (installing and testing the apps you made on your own iPod, iPhone, or iPad) you will also need to buy an Apple Developer Account for $99 a year. Its completely worth it.

After you get Xcode installed, I would start setting simple goals for yourself. Additionally, focus on an end goal instead of focusing on how to “learn to program.” So, instead of setting a goal like learning how Objective-C differs from C++, make a goal like creating an app with one button that allows you to switch the color of the view’s background. Learning Objective-C will progress as you work toward your goal.Before you start developing your first app, you should learn the basic template/setup of an iOS project.

When you first create a project, in this case, you should do the following when you go to create a new project:

  1. Select Single View Application
  2. Uncheck “use Storyboard”
  3. Make sure “use automatic reference counting” is checked (we will cover this later)
After you do that, you should see a new project created, and the left side bar should resemble the image above.
Here is the BASIC template for each view on the iPhone:
  • The header (.h) file. This contains the basic outline of your view.
  • The implementation file (.m) contains the main active components of your view.
So, lets create a simple app that has a button that changes the content of a text on the screen.
Things we will need:
  • UIButton
  • UILabel
  • IBAction (basically the method that is called when a button is tapped.)

In the header file (.h) file make sure you enter this:

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController {

UIButton *button;
UILabel *labelText;


@property (strong, nonatomic) IBOutlet UILabel *labelText;
@property (strong, nonatomic) IBOutlet UIButton *button;


Next, we will add a method that will allow the content of the UILabel we just created to change once the button is pressed. Add

– (IBAction) didPressButton;


between the last @property and the @end.

After you finish that, open up the implementation file (.m)

At the top make sure you add the @synthesize.

So, it should look like this:

@implementation ViewController

@synthesize labelText, button;


This allows the implementation file to know about the two variables you created in the header file.

To begin, there are a few things you should know about in the implementation file.

First, you should see an empty method that looks like this:

– (void)viewDidLoad


[super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.


This method, viewDidLoad, is called once when the view is first loaded into memory.
So, for the sake of this app, lets set the inital value of the text in the label in this method.

Inside the viewDidLoad method you should add

[labelText setText:@”hello!”]


This will set the body of the label to hello! when the view is initially loaded.

Next, lets add the method we created in the header file. So, after viewDidLoad you should add

– (IBAction) didPressButton:(id)sender {

[labelText setText:@”button pressed!”];


This will be called once you press a button on the screen.

So, now the code side of our app is completed. We need to link this up to the interface.

On the left panel of your screen you should click ViewController.xib.

You should then drag a UILabel and a UIButton onto the screen.


Now we need to link these components to our code.
Right click the top cube called files owner. Once you do this you should see the label and buttons we created, as well as the method.
Drag a line from the little circle next to the name of the variable onto the corresponding label or button on the screen you just added. Finally, drag a line from the method we created onto the button. Once you do that, another black box should appear. Select “touchUpInside”.

Be sure to save everything and now run it. The project should work!


Engineering vs. Developing a Product

College has taught me many things. One very, very obvious thing I have discovered is the difference between building an incredible product and being a fantastic engineer.
Personally, I do not necessarily see myself as an incredible engineer, rather I see myself as someone who cares deeply about building and refining a product.

While I have a tremendous respect for those who can do the calculus, algebra, and physics to an incredible precision, I feel that I see a different set of disciplines when building a product. Areas such as design, art, philosophy, and psychology are also important to me. I care about how a user will react and feel when using a product I am building. Additionally, I care about how the interface or appearance of an app or website will change how a user interacts with the content .

Essentially, I don’t enjoy programming because it is very technical and has many details, rather I enjoy programming because it allows me to take crazy ideas that I have and turn them into a reality. While many people have the preconceived idea that software engineers and developers are non-creative people, this is incredibly false. Many developers are incredibly creative people who have a passion for technology because it gives them the ability to build whatever they wish to.

Overall, college has made very clear the distinction between the disciplines of engineering, computer science, and entrepreneurship. Additionally, it has made clear how each person has their unique set of skills and abilities. Sure, there may be a 1000 good programmers at the University of Michigan, but perhaps only 10-15 would be fantastic people to start a company with. At the same time, maybe only 20 of the 1000 are really talented enough to build something as technically complex as the backends powering google, Facebook, twitter, etc.

Basically, I have realized this. Everyone has their own area of expertise. Some may not be the best at the creative side – they may not be able to see the importance of design and other related fields. Others may be lacking in technical areas – they struggle greatly with concepts of theoretical math and physics. Both of these types of people are incredibly valuable and have their place. Personally, I feel that I fit more into the creative  mindset with a passion for the technical components of Computer Science.

This Past Summer.

This past summer was quite possibly one of the best, busiest, and most awesome I have ever had.

First, my summer began by graduating high school (Divine Child High School to be exact). After much work (and not a whole lot of sleep) I finished high school as one of the top ten students in my class and with a pretty good idea of what I wanted to do with the rest of my life.

In early May, I had the incredible opportunity  to have dinner with Steve Wozniak, co-founder of Apple in Detroit, MI for a few hours. It was a truly amazing experience. Mr. Wozniak was extremely generous in person with his time, open to discussion of ideas, and full of advice. I talk more about the experience here:

I began the summer by working with Joe Constan and David Cicala on small freelance projects for Codevs.  Both are incredibly talented, and it was always fun to bounce ideas off each other and see what we could hack together.

In early June, Detroit Labs co-founder Nathan Hughes sent me a message on twitter simply asking what I was doing for the summer, and asked if I would like to check out some of the really cool things Detroit Labs had been up to in Downtown Detroit.


So, a few days later I went to meet with him and the rest of the Detroit Labs crew in the Compuware building. I was blown away. I could not believe that a high energy iOS, web, and Android team existed in middle of Downtown Detroit. I clicked with team instantly, and started a few days later as an iOS intern.

Throughout the summer, I worked with Henry Balanon and Jeff Kelley to develop iOS apps. I learned an incredible amount about developing for iOS, programming in general, and how to be great developer. In addition, the rest of the Detroit Labs team taught me basic business skills, more about design, and even a bit of backend web development. Now, I will keep on board Detroit Labs throughout the school year as a part time iOS developer. I also became quite the talented scooter rider around the office, and frequent consumer of Faygo slushies.

In early August, Detroit Labs was able to sponsor my way to the Teens in Tech Conference in Palo Alto, California. In 3 long, packed days, I was able to experience Silicon Valley with Henry Balanon. In one day I was able to have lunch at Apple ( thanks to Henry’s connections) and dinner at Google thanks to my friend, and Youtube software engineer, Mike Yurko. (Well, and I hung out at Stanford University in between) While in Palo Alto, I was able to both meet new people, as well as Twitter and Facebook friends in real life for the first time.

The conference was awesome, and completely worth the trip out to California. Daniel Brusilovsky did an incredible job organizing the event, and running every aspect of it. I was able to meet other teen developers and entrepreneurs. To name a few:

  1. Sahil Lavingia – an awesome iOS developer and designer (
  2. Kristina Varshavskaya – an incredible motivated person who dropped out of school to work with her sister on
  3. Brett Neese – (
  4. Spencer Schoeben – (!/netspencer)
  5. Jack Rodgers
  6.  Akash Gupta
  7. Jake Mates –
  8. J.d. Remington  –
  9. Parth Dhebar –!/pdparticle
  10. Zak Kukoff –
  11. Adam Debreczeni – kickass designer, developer, everything. –
  12. sorry if I missed anyone!

Also, I met Stacey Ferreira – a student at NYU, entrepreneur, thinker, and co-founder of My Social Cloud. When she isn’t flying across the country or hanging out with  Sir Richard Branson, she is designing, developing, or doing homework. She has an incredible amount of motivation and focus. We also have agreed to work on an iPhone app together as a side project. Since we think things like that are fun….well, and making money is always nice.

Now. I am a freshman at the University of Michigan pursuing a degree in Computer Science Engineering. Should be fun.



The Best iOS apps for Students

1.) Task PRO – Great app for managing homework and day to day tasks! Also, syncs with Toodledo, allowing the calendar data to be exported in many forms, including .ics.

2.) Penultimate – Simply the best app for taking notes in class. Allows for easy sharing of notes with others as well. Works beautifully with any stylus as well. (I prefer the Boxwave stylus.)

3.)  Dropbox – Yes, it really is that magical. Dropbox presents the best way to manage files between your computer and iOS device.

4.) Wolfram Alpha – This should explain itself. Go ahead and look at the samples included in the app and let your mind be blown.

5.) DocsToGo – One of the best word processors on the App Store. Plus, DocToGo flawlessly syncs with Google Docs and Dropbox which is practically a necessity. (for me at least…)

6.) Pulse – Not exactly an app for school, but this app allows you to keep track of new facebook posts, tweets, and any site you wish to add. Truly a great app to quickly catch up on the news.

7. Monarch Express – This app presents a way to quickly post an update to your blog or Facebook or Twitter very quickly…often a necessity when you are limited for time but want to send an update to your friends.

8.)  Stanza – Yes, sure there is iBooks, but from my experience this is simply the best ebook reader for iOS. The app supports nearly any format of book and allows you to download books from huge databases of free books. (such as Project Gutenberg.)

If anyone has suggestions for me to add, just comment on this post! I know this list is limited…

How to transform your iPod Touch or iPad into a Phone.

Alright, I have finally discovered the simplest way to transform your iPad and iPod touch into a fully functioning phone. (well, except being able to receive mms messages)

1. Use your gmail account to create a Google voice account. Select the option that allows you to have a separate Google voice number. Download the Google voice iOS app.

2. Download the Whistle app for your iOS device. Follow the in-app instructions and create an account. (You will be assigned a number.)

3. Open up Google voice in your browser and add your Whistle number as one of the linked numbers in your Google voice account. (one of the numbers the call forwards to)

4. Open the Google voice app on your device and try to call a number. When it asks you which number you would like to use for the call, make sure you select your Whistle number.

5. After you press dial, a push notification will pop up asking you whether or not you want to open Whistle to connect the call. Press answer and talk!

For texting, the Google voice app works beautifully, including push notifications for new texts.

If you found this useful, please follow me on twitter! @a_j_r  or!/a_j_r

Also, be sure to check out my company’s website, Codevs!

If you found this useful, please donate! Thanks so much!

The iPad as the Ultimate Homework Manager.

In the classroom, a typical problem I have always had is being able to easily manage my homework, tests, etc. digitally. Finally, I have the perfect setup.

I use an app called TASK Pro that syncs with a site called Toodledo . Toodledo allows me to export todo feed as an iCal feed, which then syncs online with Google Calendar, and the calendar app on my iPod and iPad.

After a week and a half of school, I love this setup. What do you guys use?

Why I Jailbroke my iPod… just went live about a week ago, and I finally decided to jailbreak my iPod.
For the last few months, I have been very hesitant to jailbreak it simply because Cydia apps were always too unstable and I do not have enough time to tinker with my iPod, or constantly restore it if I make a mistake.
Anyway, I’ve had mine jailbroken for about around a week or so now. Honestly, I really would not recommend it. I mean I love being able to install whatever I want for completely free, but the stability of Cydia apps is terrible. On my first gen iPod touch running 3.1.3, the entire device is performing probably 85% of what it was before the jailbreak. However, on the same note, the jailbreak has given me abilities that are extremely useful and productive.
Have any of you jailbroken your iPods, iPhones, iPads, etc. with
If so, what do you think of it?
Also, what Cydia apps are you using?

Why Apple Continues to Grow, while Microsoft Falls (and where linux fits into this mess)

There is a simple reason why Apple is currently dominating the tech market. Apple designs products for real, everyday people. Most people do not care if they can overclock their CPU, upgrade their ram using whatever brand of ram they want, or if they can customize the motherboard. People want technology that is simple, looks amazing, and works whenever they need it to. As more and more normal (non-computer geek) people need to be connected to the Internet or use a computer, they make the obvious choice to buy Apple products. They do not want to deal with viruses, drivers, and BSOD’s. Apple has shown with their products’ success that it does not take a computer science major to set up a computer, phone, or handheld computer. People do not mind paying the price for quality products that have been beautifully designed on the hardware, OS, and software levels. Also, Apple still has their visionary and founder in charge, Steve Jobs, while Microsoft’s Bill Gates has let Steve Ballmer simply ruin the company. Although these companies have matured and developed over the years, these companies need the original entrepreneurial genius of their founders.

Microsoft’s main use is in the workplace. This is fine. Microsoft products work fine in offices, large corporations, etc. (If they are willing to pay for an entire IT staff to fix their problems)
Microsoft Windows is simply not appealing to people. Most people end up buying Windows computers since they are usually cheaper, they have never heard of anything else, or they need it for work. Microsoft is a software company, not an all encompassing computer company like Apple. This is obvious in the products. Apple = stable devices with no issues related to hardware interfacing with software. Microsoft = instabilities resulting from driver issues, hidden viruses, etc. Microsoft will continue to decline.

Linux is an interesting thing to discuss, especially since Google has put Android Linux onto millions of smartphones worldwide. I personally love Linux, but it is simply not ready for the average computer user. Linux will continue to grow as developers continually make it more user friendly. Ubuntu has come a long way in the past few years. I think Android has set an example of what desktop linux’s potential can be.

iPad or iPod Touch

Alright so at the current moment I am debating whether or not I should buy the iPad or buy a new iPod touch to replace my first generation iPod touch. Essentially I just need something to run iOS4, which will not run on my current first gen. iPod.

Here is a list of some simple pros and cons of each device:



  1. Larger Screen.
  2. Runs both iPhone and iPad formatted apps.
  3. Full keyboard.
  4. More potential for apps.
  5. iBooks.
  6. Huge Battery Life.
  7. Can replace laptop on trips.
  8. Can attach Camera and other devices through pin-port.
  9. Bluetooth Keyboard.
  10. It looks really freaking cool.


  1. Large Screen = Larger Device = Less Portable == Not fitting in normal pockets :/
  2. More money.

New iPod Touch


  1. Size. You really can’t beat the pocket sized iPod Touch for mobility.
  2. Cheaper.
  3. Will do what my current device does, just faster and with multitasking!


  1. Small keyboard compared to the iPad.
  2. Limits me to only iPod apps.
  3. Still is missing a decent word processor.
  4. Cannot replace my laptop.

What do you guys think?