Archive for the ‘iPhone’ Category

Multitasking Opt-Out

Friday, September 3rd, 2010

Given just how much of a hassle it can be to support multitasking on the iPhone, it’s worth a quick mention that it’s possible to opt out of the whole thing.

All you need do is add this pair to your Info.plist dictionary:

<key>UIApplicationExitsOnSuspend</key>
<true/>

Which looks like this in XCode’s plist editor:
opt out

Although AAPL harumphs that “[o]pting out of background execution is strongly discouraged”, for some apps it may make little difference, and save you not inconsiderable effort.

Demine iOS 4.0 Upgrades (Multitasking Part 2)

Friday, August 20th, 2010

Today we’re going to finish updating the Demine project for the iOS 4.0 environment by adding complete support for multitasking. Even though Demine is not going to be doing any background processing, it turns out that a multitasking environment mandates certain changes to the program; some we saw last week, and the balance we’ll see now.

(We’ll be making changes to the project as we left it last week; you can download the final version here.)

(more…)

Demine iOS 4.0 Upgrades (Multitasking Part 1)

Friday, August 13th, 2010

Today we’re going to continue updating the Demine project for the iOS 4.0 environment: we’re going to begin to add support for multitasking. Even though Demine is not going to be doing any background processing, it turns out that a multitasking environment mandates certain changes to the program, as we shall soon see.

(more…)

Demine iOS 4.0 Upgrades (Resolution)

Friday, August 6th, 2010

I want to walk through the process of updating the Demine project for the iOS 4.0 environment. This procedure is more complex than that associated with retargeting for earlier OSes, largely because iOS 4.0 adds support for multitasking and for high-resolution devices. Although these features don’t demand explicit application support, a developer is well-advised to consider them in his code. Today I’m going to look at the issues raised by high-resolution screens, and next week we’ll consider the implications of multitasking.

(more…)

High-Def Chevrons

Friday, July 30th, 2010

NormalJust a quick note today. I’ve previously written here (and also here: whoops!) about my UIButton+NavButton category, which I use to create my own “back” buttons for navigation controllers, so that I can cross-fade them properly.

NormalIt turns out that the code (header here, implementation here) works just fine on high-resolution devices. The only thing you need do to completely support such devices is to provide some high-resolution artwork. Just grab the high-def back_norm@2x.png and back_click@2x.png images and include them in your project; the runtime will detect and use them automatically when appropriate. (Leave the original artwork in place for standard resolution screens.)

CATiledLayer (Part 2)

Friday, July 23rd, 2010

Let’s add on to our previous CATiledLayer demo by implementing zooming. This is one of those things that worked a lot better than I thought it would, but, arguably, still didn’t work well enough. The built-in zoom support in CATiledLayer integrates well (i.e., easily) with a UIScrollView, but it doesn’t quite work the way I’d like, and it’s not obvious how it might be tweaked to work better. Let’s take a look at some code, and I’ll show you what I mean. (You can download the complete project for this week’s demo here.)

(more…)

Taipan! Mobile

Thursday, July 22nd, 2010

Taipan! screenshotGuess who just got their new game approved and placed in the app store? That’s right: It’s me.

If you’d like your shiny new iPhone to do a credible imitation of a 28 year old Apple ][, then you should totally go to the iTunes store and download my port of Taipan! right this very instant. Right now! Don’t wait one minute more!

Seriously, why are you still here?

Kidding aside, I’m pretty proud of this port. I’ve always had a deep fondness for this game, and this port is extraordinarily faithful to the original game balance. Plus, I made every effort to optimize the interface for ease-of-use on a handheld. It’s simple, fun, and addictive. And you should download it. And leave a good review. And buy the unlock.

CATiledLayer (Part 1)

Friday, July 16th, 2010

Let’s take a look at a CATiledLayer demo. I first ran across the CATiledLayer class when I was looking into a multithreaded, tiled, vector-graphics rendering solution for the Demine project. I didn’t pursue it at that time because it looked like it would be a bit of a job to understand and deploy, and I already had a workable rendering engine based on blitting. Now, however, I’d like to return to it.

What I’m going to present today (you can download the complete project here) is very much a work-in-progess. This demo shows how the CATiledLayer class can be made to do certain things, but it doesn’t address (at least) two very important problems: how to zoom, and how to handle the hazards of multithreading. I’ll talk briefly about both, but a thorough discussion will have to wait for another day. Now, without further preamble, let’s get started!

(more…)

4.0 Button Update

Monday, July 12th, 2010

I’ve updated my Shiny Red Button code to render high-resolution buttons on high-resolution devices. This code must be linked against the iOS 4.0 SDK, but can target iOS 3.0. You can download the header and source files right away, or read a bit about the change below.

(more…)

Transforms

Friday, June 25th, 2010

When I discussed how to resize UIPickerViews last year, I touched upon the fact that a UIView's transform property is rather unusual; according to the documentation:

The origin of the transform is the value of the center property, or the layer’s anchorPoint property if it was changed. (Use the layer property to get the underlying Core Animation layer object.)

This turns out to be something of a hassle when trying to reason about transformations. Fortunately, a little math can sort things out.

(more…)