Author Archive

January 4, 2013 0

Endless loop on background thread

By admin in iOS

There are times when for whatever reason, you need to have a thread run in the background an extended period of time. Here’s a simple way of accomplishing that. In the .h ( Note that we have set the variable to atomic, this is required to prevent one thread from writing while the other one [...]

December 7, 2012 5

Using Cinder in an iOS project

By admin in iOS

One of the problems when using Cinder in an iOS project, is that the default template essentially wants to take over the entire application. No more Objective-C, or UIKit. Which you might think, Oh no! I don’t want to re-implement all those UI elements people are accustomed to on iOS. Luckily there islibrary out currently [...]

Tags: , ,

March 18, 2011 11

Combining Cocos2D with UIKit and UIToolbar

By admin in Uncategorized

Cocos2D is an awesome 2D iphone game engine, it’s just really really good and the code inside is nicely organized. However, to a beginner using Cocos2D it would seem that it does not work with UIKit based applications, this impression is largely Cocos2D’s fault. I recently started a new game, and my plan is to [...]

Tags: ,

January 30, 2011 7

Cocos2D Forced Kerning

By admin in iOS

In Cocos2D you display text, any number of ways. A popular method for displaying text is to use BitmapFont, that is – a font created in a program which outputs two files. A bitmap (say a png for example), and a plain text ‘.fnt’ file, containing information regarding where each character is in that file. [...]

Tags: , , ,

January 27, 2011 0

New Stanford course is online

By admin in iOS

I learned a lot by watching the original course, nothing like having someone explain in lecture form, after reading about these concepts for a while. And now it looks like, they’ve updated the course. The new instructor has a more calm style, seems like it will be good. http://itunes.apple.com/us/itunes-u/developing-apps-for-ios-sd/id395631522 This is from the first few minutes [...]

Tags:

October 30, 2010 1

Better NSLog – Adding function name / line number to NSLog

By admin in iOS

When tracking down a bug, the most useful way to start checking things is to NSLog something. I’m a heavy user of breakpoints and the debugger. I can’t live without it, and it’s saved me countless hours. However I usually see if i can NSLog something first perhaps the problem was an obvious one. A [...]

Tags:

October 26, 2010 4

The best form submission class (asi-http-request)

By admin in iOS

Small but quick snippet here. Sending multi-part form with image data: NSString *imagePath = NSString *imagePath = [NSString stringWithFormat:@"%@/%@", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject], @"junny.png"];   UIImage *image = [UIImage imageWithContentsOfFile:imagePath]; NSData * imageData = UIImageJPEGRepresentation(image, 0.75)   ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:http://example.com/form.php]]; [request setPostValue:@"I like brains!" forKey:@"title"]; [request setPostValue:[NSString stringWithFormat:@"%@", [NSDate date]] forKey:@"session"];l [request [...]

Tags:

October 14, 2010 2

Parsing Delimited String from XMLNode on iOS using GDataXMLNode

By admin in iOS

Often when you work with XML, you need to put a bunch of values into a node, maybe positioning information for example. The best way to do that is to create a “Delimited String”, that is “ABC|123|XYZ|987″, is delimited by the | character. Here’s how you get that back in iOS into an array, that [...]

Tags:

October 10, 2010 7

Reading / Creating XML in iOS

By admin in Uncategorized

As I’ve mentioned previously, this blog serves as a kind of social-bookmarker, and exist somewhat in order for me to chronologically log my learning experience with iOS programming. So not everything I post is always a how-to or a tip, but sometimes I will share something which I read that I found useful that people [...]

Tags: , ,

October 6, 2010 0

Post-A-Day #10 UIViewController’s views

By admin in iOS

-(void) someEventDidOccur EditOptionsViewController *anEditOptionsViewController = [modalViewControllers_ objectForKey:@"someName"];   // A little note about retain/release // views are not aware of their UIViewController // When they don’t have one, and .view is requested UIViewController will simply create a new one. // In the code below, if the order were reversed, "anEditOptionsViewController" would be dealloced // // [...]

Tags: