Archive for February, 2009

Make Me Laugh!

Yes, we are a full service shop here at Trollwerks; not only do we write your application for you, we’ll shepherd it right through the publishing process for you as well. And tonight the first application we’ve done that for is up!

Well, actually, it’s not the first one we’ve done that for — but it’s the first to actually get approved. We’ll have some choice observations on that. But anyways. This is published on behalf of, who had the excellent judgement to have Trollwerks take care of their debut iPhone application, Make Me Laugh! And it … well, eponymously enough, it makes the iPhone laugh. Wildy and crazily.


You may have noted if you follow the App Store rankings that the, ah, anthropomorphic audio reproduction shall we say? class of application has had quite spectacular sales success. So hey, there is absolutely no doubt we’ll see Make Me Laugh! enjoy the same. Go ahead, click the button and buy it. You know you want to!

Make Me Laugh!

Continue Reading →

UIWebView internals

As you’ve no doubt noticed if you’ve tried to do anything even mildly different with UIWebView — oh, like, just to take a completely random sample, wanting to call -setCustomUserAgent: on it for the convenience of the server your application is presenting content from — the public interface is very limited, and WebKit/WebView.h is a private framework, so no SDK-compliant coding for YOU!

However, if you’re not overly concerned with the strictest adherence possible to the rules, here’s a fellow who’s worked out how to get at the internal WebView, for purposes of presenting a progress bar:

So, say you have a UIWebView called officialSDKWebView. We want to extract the main WebView from that to get the progress. To do so, we have to use another internal class called UIWebDocumentView. From there, we can get the WebView easily. Here’s the code:

UIWebDocumentView *documentView = [officialSDKWebView _documentView];
WebView *coreWebView = [documentView webView];

There’s a couple ah, non-standard header files required, and maybe a bit of other messing about in the project, but it’s all provided in that post. And once you follow it, you do appear to indeed have a genuine WebKit WebView that you can call anything from your desktop code on. Like, in the case of our completely random sample above,

[coreWebView setCustomUserAgent:@"I'm an iPhone!"];


Of course, we would never actually recommend that you violate the published SDK guidelines, that is unsafe and irresponsible, yada yada yada. That said, relying on the iPhone SDK’s WebView to have its internals remain consistent with the desktop SDK’s … that is, most likely, a pretty darn safe bet.

h/t: iPhoneKicks!

Continue Reading →

Symbol6 post mortem

The people who wrote the Symbol6 iPhone game have a couple worthwhile posts on the process for you:

… Some concepts never make it past the “few lines and an image” stage (the initial idea stage), while others become drafts that are developed and “finalized” (of course concepts are never “finalized”, but there is a point where you have to stop and decide that you’ve reached the stage that separates concept from full blown design). A finalized concept feels complete when…

Symbol6 : How We Created an iPhone Game

… This is the first post in the series (or the second, if you include the original post) and it is intended to work as an outline for later posts – a table of contents, of sorts.

It is written in the “Top 10″ style of Guy Kawazaki – mainly because currently the writer has just read a few “Top 10″ posts by Guy and is stuck in the format. A recent David Letterman sketch on Youtube is also to blame…

But without further ado, here are …

Ten things to do before creating your first iPhone game

Keep an eye on that series!

Continue Reading →

URL IPC update

You may recall us mentioning back a while that some clever sparks had come up with the idea of implementing inter-iPhone-application IPC by means of registering custom URL schemes. Although there’s still a number of rough edges, it has worked out fairly functional and more work’s been done around that area, to “allow iPhone apps to work similarly to Android’s Intents”. Whatever it is that those might be.

Here’s a screencast demonstrating URL IPC in a diceshaker application.

The code for the above applications is at diceshaker and iphone-ipc-sample-diceshaker on GitHub.

There’s a page “ChooseYourOwniPhoneURLScheme” on where you can see what schemes have been publicized for you to use.

Here’s a writeup from the people who integrated a credit card app and a point of sale app.

And here’s a thread on the developer forums for further discussion!

Continue Reading →

OmniObjectMeter freed!

Here’s a nice gift for Cocoa programmers: OmniObjectMeter is now free! And for regular users, so are OmniDiskSweeper, OmniDazzle, and OmniWeb. What, is it Christmas again already?

OmniObjectMeter tracks every retain, release, and autorelease in your  application, and helps you pair them up to find zombies and leaks. We’ve been selling it for years, but today we’ve decided to release it as freeware (along with OmniWeb, OmniDiskSweeper, and OmniDazzle) as we focus our development efforts on our major products (OmniGraffle,  OmniFocus, OmniPlan, and OmniOutliner).

And not only are they giving all these goodies away, there’s new versions of their open source frameworks too:

P.S. — We also recently posted updated versions of our open source Omni frameworks to github, including OmniDataObjects (our CoreData-like implementation which works on both Mac and iPhone).  For more information, see <>.

What nice people Omni are, indeed!

h/t: cocoa-dev!

Continue Reading →

OpenGL ES + CATransform3D

Well, here’s a followup to yesterday’s post on CATransform3D: The fellow who wrote the 3D molecular visualizer Molecules that we mentioned back when it was open sourced decided to apply that work to Molecules’ rendering routines, and it worked out pretty well!

It turns out that the CATransform3D struct provided by Core Animation for doing manipulation of CALayers is identical in structure to the model view matrix in OpenGL (ES). In fact, Apple has provided us with a number of functions for manipulating this CATransform3D struct in ways that correspond to glRotate, glScale, and glTranslate calls.

This solves the biggest known problem I had with Molecules’ rendering routines: for me to do rotation and translation relative to the user’s touch input, I had to know the state of the model view matrix at all times. In the current version of the program, that means that I had to use a few glGetFloatv calls to query the current state of the model view matrix. Each of these calls halted the rendering pipeline, so I needed a way to get rid of them.

CATransform3D and its supporting functions provide the means to do that. I could keep track of the current model view matrix in a CATransform3D, perform manipulations on that structure, and just replace the OpenGL model view matrix with it every time there was a change…

…this quick set of optimizations leads to an increase of 14-25% (depending on the specific model) in the number of triangles per second that Molecules was able to push through the iPhone’s GPU. This means that on the iPhone 2.2 firmware, I’m now getting a max of 310,000 triangles per second. This is still short of the 470,000 triangles per second the iPhone is capable of under these conditions, as reported elsewhere. There’s still some room to improve, but I’m getting there.

So there you go. If you’ve got any complicated OpenGL transformations to keep track of, look into CoreAnimation!

h/t: iPhoneKicks!

Continue Reading →

Code: Trackball

Now here’s a nifty piece: How to do 3D object transformations without OpenGL — all simply using CoreAnimation! It’s called Trackball and the details can be found here:

The idea is that you have a 2D viewport into a 3D scene, this view port has a width and height (i.e. the CGRect that defines the layers bounds). In this 3D world you construct an imaginary sphere with a radius of the minimum of height or width of your view port centered on the center of your scene. When the event begins (with a touchesBegan:withEvent:) you initialize the trackball with the touches location as the starting point. A vector is constructed from the center of the sphere to the touch (the depth dimension is calculated based on the radius of the sphere). As the user moves her finger around on the screen another vector is constructed from the center of the sphere to the current touch location (as received in touchesMoved:withEvent:). The cross product of these two vectors is the vector of rotation and the angle between them is the magnitude of the rotation.

If all that is a little bit overwhelming, there’s a followup post with a sample application – but an even better example can be found on github where some bright spark has put together a project called ‘Cubo’ which makes it really easy to visualize the transformations by use of a numbered cube, like this:


Cool stuff, indeed. We’d also like to point out that the originator of the Trackball code is the Bill Dudney that wrote the most excellent Core Animation for Mac OS X and the iPhone book, which if you don’t have you should click on that link and purchase immediately, and is coauthor on a new iPhone SDK Development book which will no doubt also be well worth your time to order!

[EDIT: And also check out tomorrow's post about applying Core Animation to Open GL transformations!]

h/t: iPhoneKicks!

Continue Reading →

Library: Route Me

Always interesting to keep track of mapping solutions for the iPhone, and here’s an interesting looking one: Route Me, which is up on Google Code and BSD open-sourced:


Nice-looking, and remarkably flexible to boot:

Currently OpenStreetMap Microsoft VirtualEarth and CloudMade are supported as map sources.

Use it in your iPhone project. Its licensed under the new BSD license.

You are responsible for getting permission to use the map data.

… of course, that last bit is the trick.

h/t: iPhoneSDK!

Continue Reading →

App Store insights

Here’s a couple interesting posts on pricing vs. sales results in the App Store.

App Store Marketing

Of AppStore and Bad Ideas

Executive summary: Pricing cheap is a mug’s game. But you knew that, didn’t you?

Continue Reading →

OpenGL roundup

Here’s a blog chock full of meaty programming goodness we hadn’t stumbled over before: iPhone Development. The particular post we found a reference to was a collection of OpenGL articles from December,

These past three days have seen a flurry of postings. I thought I’d just do a quick table of contents to the various tutorials and postings I’ve done recently, in the order they should be read:

but there’s been a good bit of updates since then. Catch them all by looking for the OpenGL ES tag, or if you’d like a bit of a refresher the OpenGL From the Ground Up series, but we’ll draw your attention particularly to this post providing an updated version of the Xcode template post above:

Here is a new version of my OpenGL ES project template for Xcode. This version adds a class called “OpenGLCommon.h”, which contains data structures and inline functions for vertices, vectors, triangles, etc. – mostly stuff from the Wavefront OBJ class that has generic applicability, backported into the template.

h/t: iPhoneKicks!


And here’s another good OpenGL ES article at Dr. Dobbs written by the author of The OpenGL SuperBible, which if you don’t have we recommend you buy immediately.

Another roundup post with some new links — and the blog it’s from has lots more OpenGL stuff!

And here’s a very good iPhone focused series of OpenGL tutorials — up to #4 on 09.05.15!

That no glBegin()/glEnd() bit got you stumped? Read OpenGL Vertex Buffer Objects (VBOs): A Simple Tutorial!

Continue Reading →
Page 1 of 2 12