Archive for 'iPhone'

Code: zip

Feel like using .zip compressed files in your iPhone program? Here’s a couple wrappers for Minizip to make that process easy!

For super simple needs, there’s nuzip on github:

NuZip currently has a trivially simple interface, methods called “zip:” and “unzip:” that take a single argument, a string that would correspond to the command-line arguments given to the minizip and miniunz tools…

And if you need a little more, there’s ZipArchive found on Google Code:

… it’s easy to use, you can declare a instance and call initialize functions, and then call addFileToZip or UnzipFileTo to finish compression or uncompression…

Also note some good advice in this thread about dealing with NSData objects and .gz files.


Open Source Libraries And Examples For Zip, Rar, and 7-Zip Compression

Open Source Easy To Use iOS Zip Compress Library

mattt / Godzippa: “GZip Compression / Decompression Category for NSData”.

Objective-C Library Providing A Clean Syntax For Unarchiving Zip, Rar, And 7zip Files

Open Source iOS Library Providing Direct Access To Data Stored Within Zip Files

Continue Reading →

Resources: cocos2d

So there seems to have developed a general consensus in the iPhone development community that if you’re planning to develop a sprite-based game, the cocos2d-iphone framework that we mentioned waaaaaay back when and a bit later on is the way to go. So since we’re planning on doing exactly that, here’s a roundup of resources for your cocos2d development!

Project and wiki on Google Code, for starters. is the official center for all things cocos2d.

Sapus Media is the creator’s home page with links to cocos2d related stuff as well. Note blog.

cocos2d for iPhone API reference is there as well. Also note wiki. And how to install in Xcode.

Sapus Tongue source and optional support is available at varying prices, and we strongly recommend you support the author by purchasing it — hey, we did!

cocos2d-iphone-discuss is the nice and active discussion list. Note the community pages there as well.

[UPDATE: Due to massive Google suckage, the community is now a bbPress forum!] is the original Linux/Mac/Windows library using Python instead of Objective-C, where more useful documentation can be found.

cocos Live is a Google App Engine-hosted service for high score submissions.

cocoslive-discuss is the companion list for cocos Live.

[UPDATE: Now it's part of the above bbPress forum too!]

And more good stuff found around the web includes

Whitepaper: Introduction to Cocos2d iPhone from the experiences of the authors creating touchDefense with it.

Also see the cocos2d tag on one of the touchDefense authors’ blog … and on the other one’s too. Particuarly this post and source project about sprite colouring.

Here is a tutorial series covering setup through collisions and particle systems; also check out others with the cocos2d tag on that blog.

Cocos2d: Bouncing Ball Example is a walkthrough of creating a scripted animation.

Cocos2d Example – Bouncing Ball is, oddly enough, completely different than the last one, a walkthrough of creating non-scripted animation!

Scripting cocos2d-iPhone actions with XML is for your really hard-core scripting needs.

This fellow has open sourced his ABC123 game and a tile based game shell with accompanying tile map editor; see lots of good blog posts as well. Not to mention a cocos Live WordPress plugin, of all things.

Gorillas is another open sourced cocos2d game.

In case you missed it in the discussion links above, more sample games and miscellaneous files can be found at cocos2d-iphone-discuss.

Texture Atlas Creator is a nifty web application for, well, creating texture atlases, eponymously enough.

Speaking of which, Using Cocos2D AtlasSpriteManager has useful advice on using them.

Making Seamless Repeating Backgrounds is a helpful tutorial.

The SilentMac Design blog has some good cocos-tagged entries too.

Cocos2d Iphone Dynamically Touch Detection has some advice on implementing touchable sprites.

An introduction to game physics with Chipmunk gives you an excellent tutorial on the physics engine that comes with cocos2d.

If you like videos, here’s a Hello World app creation walkthrough.

And there’s various project templates in the above links, but here’s another and yet another on github. And even yet another on Google Code. And yet^4 another … and yet^5 another … they’re just everywhere!

… and finally, here is a bit of amusement for you. Remember when we posted that 3D engine roundup, and said “we’re definitely going to follow his experiences with the engines of choice!” Well, here’s your followup: he ended up using cocos2d with the Box2d engine port!

Over Easter I decided to drop a dimension in my iPhone project to go from a 3D evolution game simulator to 2D… It was obvious that cocos2d had already solved the problem of a simple game engine, and then some.

I was decided. The rapid progress I was able to affect in 2D with both chipmunk and box2d as well as the ready-to-exploit and well documented cocos2d game engine convinced me…

Well, with an endorsement like that, we know we’re on the right track here, yes?


BIT-101 Blog has some useful posts on curves, colors, menus, ... cocos2d tutorials gathered here!

Any more to suggest, Dear Readers?]

Continue Reading →

Tools: Clang

So we’ve mentioned the LLVM/Clang Static Analyzer already in passing, but there’s enough resources springing up all over to merit some more attention:

Bug Finding With Clang: 5 Resources To Get You Started has usefully descriptive links.

Automated Clang From Xcode has an AppleScript to enhance the convenience.

And for the ultimate in convenience, here is AnalysisTool: a GUI application which allows running both official and their custom analyses!

Well, we wouldn’t want to recommend anything without actual personal experience, so let’s run it over the project we submitted to Apple end of last week…

… OMFG!! 145 — ONE HUNDRED FORTY-FIVE — BUGS!! OK, deep breaths, deep breaths, let’s look at what they are. OK, those are in libvorbis, not actually a problem; and these are in libfaac, nothing immediately fatal there either; and libflac has some too, again no need to panic; and precisely one (a shadowed variable in framing.c, since you asked) in libogg.

And in my source … not a single one. No, not ‘just false positives’, actually no not a single quibble anywhere. We’re not completely certain if that makes us actually as clever as we’d like you to think we are, or just utterly OCD on our coding hygiene. Of course, there’s always the both option isn’t there?

In any case, we thoroughly recommend that no matter what you’re programming for, you familiarize yourself with Clang!

Continue Reading →

Tip: iPhone Virtual Memory

“What?” you’re no doubt thinking, “is he going on about? Everyone knows there’s no virtual memory on the iPhone!”

Ah, young padawan, let us correct your misconception. It turns out that, indeed, there actually is. Take a look through this moderately amusing rant about the indeterminacy of memory allotments on the iPhone and into the comments. There’s a variety of suggestions about killing other processes, hogging memory to your own process, and in general going out of your way to not play nice with others; which, well, that’s not the iPhone way, is it now? But then, there’s this piece of solid gold:

There actually is a virtual memory system pager. However you have to manually set it up.
Search for ‘mmap’ in Apple’s iPhone Developer Forum and you’ll find a very informative thread.
Basically, it works like this: In place of malloc, you create a file of the appropriate size and then memory map that file using mmap. The virtual memory pager will page in and out the memory pages as needed. This works both for read-only data (you can just use [NSData dataWithContentsOfMappedFile: ] for that) as well as read-write memory.

Woah. We were utterly and completely unaware that was supported on the iPhone. mmap FTW!

h/t: iPhoneKicks!

Continue Reading →

Code: GLGestureRecognizer

This looks nifty; a gesture recognition implementation for the iPhone!

GLGestureRecognizer is a Objective-C implementation of the $1 Unistroke Recognizer, a simple gesture recognition algorithm. It was implemented over the course of a couple evenings in late April 2009 by Adam Preble.

Not that we actually have any immediate use for it, but hey in case something comes up, the code is on github and open source, so there you go!

[EDIT: And the very next day, Mobile Orchard has a post on iPhone Circle Gesture Detection too!]

Continue Reading →


Ah, here’s another fine job well done: “POssO” the one and only OpenSSO administration application for the iPhone is now live!


POssO adds the much desired remote management feature to your corporate identity management infrastructure, enabling you to achieve better efficiency and accessibility in your organization.

With features like:

1. Create Identities

2. Manage Identities

3. Search Identities

4. Password Management

5. Role Management

6. Policy Management

7. Session Management

8. Cisco VPN Client Support

You can manage your corporate profile remotely adding flexibility to your schedule. It will revolutionalize the way you manage your corporate identity management infrastructure.

Rather narrowly targeted, yes, but hey if you have a use for it … grab it now!

Get POssO

And we’re particularly tickled to note that after more than a dozen applications, the TrollSheep has finally made it into the UI for one of them … check the credits!

Continue Reading →

Pledging for icons

As you may have noted previously, the artistic skills are not ones of noted accomplishment by trolls. (Aside, that is, from performance art. We’re real good at that, as pretty much anyone who’s met us will attest, we trust.) So we were pleased as punch to stumble across this cleverly named site with a set of nice-looking free UIToolbar/UITabBar icons! We’ll download those immediately, yes…

But wait, what’s this over on the side?


a “kickstart”? What is a “kickstart”? Well, it turns out that is


Kickstarter is a funding platform for artists, designers, filmmakers, musicians, journalists, inventors, bloggers, explorers…

Now that’s intriguing, isn’t it? Here’s the details, but the basic upshot is it’s a website for organizing pledge drives. If enough people sign up to reach the pledge amount, everyone pays their pledge, if not, no one does. An interesting concept, and certainly looks like it has more potential than a donationware model.

So the designer fellow has a project page there where he offers rewards for various levels of pledging, starting with

I make cool icons for iPhone developers at and if I can collect $500 in donations, I’ll release the whole set of icons in vector format (SVG + Illustrator) for use in apps, posters, tshirts, whatever!

And that has worked out pretty well for him; it was up to $685 when we arrived, and hey we did think the icons were pretty nice and we were curious to try this Kickstart thing out besides, so we kicked in $20 to see how it went. Which was smoothly. So the nifty idea here appears to be implemented competently, which is always a nice bonus.

So, that certainly is an interesting alternative to consider for funding your development … or anything else … isn’t it? There’s a wide variety of different kinds of projects to explore, but we note with particular interest this project to accumulate enough pledges to remove ads from this iGoozex app. Which, well, we have no use for ourselves, but we’ll certainly be checking back to see how that works out for this fellow with people who do, and if it looks like this concept has some hope of working for developers as well as artists, we’ll see about trying this idea out for some project of our own perhaps. It certainly would be a nifty way of prejudging actual user interest in an application concept!

Continue Reading →

Resources: Core Data

So not all that long ago we put together a list of resources for getting into the gritty details of SQLite for your iPhone data management needs. And as chances are you’ve heard, that’s all unnecessary now because the awesomeness which is Core Data will be available on iPhone OS 3.o. Sooooo, as soon as you can target OS 3+ only, it behooves you to get up to speed on it!

First off, here’s a brief concepts overview to get you started.

Then visit Cocoa Dev Central for the exceedingly worthwhile Class Overview and sample application walkthrough.

Then go trawl the mothership for Officially Sanctioned resources, starting with the Programming Guide.

As always, cocoadev is a great resource for anything related to Cocoa, and Core Data is no exception.

A variety of interesting Core Data posts at Cocoa With Love.

And another good collection at Cocoa Is My Girlfriend.

And speaking of CIMGF, the great folks at Pragmatic (have you got their Core Animation book yet?) are bringing out a book on Core Data in the near future by Marcus Zarra of that blog, and based on what we’ve seen from all involved so far we’ll just go out on a limb here and recommend that you’re absolutely certain to find it invaluable and you should just click the picture and preorder it NOW!


[EDIT: And there's a new tutorial series starting here that looks worth following as well.]

Continue Reading →

Tutorial: JSON over HTTP

We’ve mentioned the json-framework project before; but here’s an excellent tutorial on how exactly to use it that you really should not miss if that’s something you need to do.

Also note this other alternative, ObjectiveResource, which handles both XML and JSON deserialization in the context of interacting with Ruby on Rails applications, a port of Ruby’s ActiveResource apparently…

h/t: iPhoneKicks!

Continue Reading →

Snippet: Orientation

Here’s a useful post on dealing with interface orientation changes:

One of the features with which I had to get fairly intimate with on the iPhone over the last couple of months was working with orientation changes. At first my code was completely incorrect and it wasn’t immediately obvious to me how to get my application to reorient itself properly. This was mainly due to the structure of my code. In this post I am going to explain a simple, memory efficient way of working with UIViewController and interface orientation changes.

We draw your attention particularly to the ‘Pitfalls’ discussion:

… I did have an issue where I was using 3 view controllers. Let’s call them A, B and C. A switched to B and vice-versa when the phone’s orientation changed. C was loaded by B and was viewable in landscape and portrait orientations. The problem came in where if you changed C’s orientation and then the user navigated back to B where B had a different orientation, you would effectively not be notified of an orientation change. If you subsequently changed B’s orientation to load A, you would find A would load in the wrong orientation. Oops, bug…

So how did I solve this? Well all I did was put this piece of code in A so that it would manually reorient itself from portrait to landscape:

- (void)viewDidAppear:(BOOL)animated {
		[UIView beginAnimations:@”View Flip” context:nil];
		[UIView setAnimationDuration:0.5f];
		[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
		self.view.transform = CGAffineTransformIdentity;
		self.view.transform = 
			CGAffineTransformMakeRotation(MPI * (90) / 180.0);
		self.view.bounds = CGRectMake(0.0f, 0.0f, 480.0f, 320.0f); = CGPointMake(160.0f, 240.0f);
		[UIView commitAnimations];

That’s a handy little snippet to keep in mind, indeed.

h/t: iPhoneSDK!

Continue Reading →
Page 80 of 99 «...5060707879808182...»