The Making App Pie Tutorial: The Adventure Begins

I’ve been at Xcode and cocoa Touch for over a year. I’ve had over  1,400 downloads of my apps from the app store and learned a lot about programming in Xcode.

I’ve realized something during this time: Programming in OOP is not like programming in C or Basic. When you have a graphic environment like Xcode, with storyboards to help you, the entire game if different, and it’s more about the rules you unlearn than learn as a programmer.

So I asked myself a question: What if someone who knows enough to handle Microsoft Word  or Pages would be taught Xcode from the ground up?

So we begin an adventure the Making App Pie tutorials will be regularly posted tutorials on how to make apps for the iPhone at first , and eventually the iPad as well.

You will need the following to play along at home:

  • The latest version of Xcode
  • A Macintosh computer ( since Xcode only runs on a mac)
  • A Developer’s license. There are two varieties of these, the free one and the $99/yr one. The big difference is the paid license lets you put your apps on a real phone, the free one restricts you to the simulator. I strongly suggest getting the paid developer’s license, but it will be months before we will do anything the requires you to upload an app to a phone. You can begin the registration process here:

What we will do over the course is create an adventure game. The idea of this game is to learn Xcode, not to write games. Those of you interested in productivity apps will learn the fundamentals for those types of apps as well. Some of the parts of this adventure will be components for many types of non-game apps. I’m just making a conceptual framework that will help everyone think correctly about Object Oriented Programming.

Hope you join me in a great adventure.





How to get a string with the Date and time in XCode / Cocoa Touch

There are times  you look for something simple, and get very frustrated. One of those for me was getting a freaking time stamp on my app.

After a bit of chasing around, I did find this in Apple’s documentation, in case you are looking for it.

// code to get the date and time  in a string.
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
    [dateFormatter setTimeStyle:NSDateFormatterMediumStyle];
    NSDate *date = [NSDate date];
    NSString *formattedDateString = [dateFormatter stringFromDate:date];

Note there are other constant you can use besides NSDateMediumStyle.

Check out the NSDateFormatter Class Reference for the whole story

And Another thing: Zero Parameters

So I keep forgetting how to convert from NSString to values. there is a series of methods defined in the NSstring class to do this, such as intValue and floatValue. I keep thinking this backwards, getting confused on a case where there is no parameters in a message. the data is already part of the object.

I keep thinking of something long the lines of

int intensityValue = sender.titleLabel.text.intValue();

when it really is:

int intensityValue = [sender.titleLabel.text intValue];

No colon or indication of parameter, even empty parameter.

Gotta remember this.

Hello world!

Like everything in the programming community, It’s important to start with a “hello World”  program, or in this case a post.

So here I go, Posting stuff.

This is not you normal advice blog for app developers.  There is a lot of more knowledgeable ones, like for that.

I started programming with a brand spanking new TRS-80 with a whopping 4K of memory,  and have learned many programming languages in the time since then. I’m bewildered by this wonderful thing called app development, even though it’s dream programming to me.

So I’m learning the Xcode 4 thing with iOS 5.1.  Though blundering along is more like it.

I’m learning a lot like I make pies, I find a pie shell, stick some ingredients in and see what happens. Sometimes I get delicious pie. Sometime pie on my face.

You find the same thing here, as I problem solve my way to creating apps.

Bass ackwards with Objective C.

It drives me nuts, thinking backwards.

in Java or C++ or C, functions and methods are simple. They’re close to what I did in Pascal a quarter century ago:

public int sampleMethod(int y){
//statements go here
return y;

and then the call would be


No biggie. If sampleMethod was in a an object I was calling,

a= theObject.samplemethod(5);

But Objective C turned things around. Definitions are simple enough for single parameters:

- (int) SampleMethod:(int) y {
//statements go here

but the sending a message looks so different:

a=[theObject samplemethod: 5];

I get confused.  when you have something with multiple parameters in it like

-(void) fillCircleAtPoint:(CGPoint)p withRadius:(CGFloat)radius inContext:(CGContextRef) context{ //stuff here


and sending a message to

[self   fillCircleAtPoint:p withRadius:radius*0.5 inContext:context];

it just seems wrong. The withRadius: and inContext: just seem wrong.

They aren’t of course, and it does add to readability.

I get stuck with remembering which object I’m sending a message to, and those funky multiple parameter methods with the extra bits.

I’m silly I’m sure, but it is a paradigm change for me, And I’m guessing someone who will eventually read this.

See you are not the only silly person out there.