Feb 162010
 

Listening to some people, the lack of Flash on the iPhone/iPad is some sort of crime against nature. There are numerous complaints about it online – all bemoaning the inability to play their favourite Flash games or view video. These complaints miss the point entirely – there are two simple reasons why Flash will never be supported in Mobile Safari.

The first reason is simple – Steve Jobs is a jealous God and thou shall have no other Gods besides Him. Apple created the App store so they would control the single way of getting software onto the device, being able to load a flash file from a browser completely circumvents this control. Simple.

Now we have that out of the way, we can move onto the second, more interesting, reason.

Flash would suck on the iPhone.

Lets talk about Flash video first. Most video sites use a custom Flash wrapper to display video in a sub-frame of the browser, with controls to zoom the video to full screen. The sub-frame is usually of a fixed size (640*360, etc) and surrounded by additional HTML (ads, links to other videos, etc). Straight away you should see the problem – the video is already bigger than the iPhones screen. Mobile Safari does an excellent job of resizing web pages, but that is going to leave you with a postage stamp sized video with even smaller controls. Going fullscreen may be a solution, if you can mange to tap the tiny button, but then you are not really using Flash as part of a web page anymore.

Back in the day (about 5 years ago), Flash video was a step above anything else on the web due to its widely deployed and not-too-bad codec. These days Flash is just a none-too-convenient way of displaying standard h264 files which the iPhone can play natively. Most of the big video sites have realized this and just serve the raw file to iPhones instead of trying to wrap it in a custom player, to the benefit of everyone.

(Drifting slightly off-topic for a moment, I imagine the use of Flash as a video player will start to decline even of desktops now that HTML5 is here with its useful <video> tag.)

Now lets talk about Flash games – Tower Defense, Crayon Physics, room escape puzzles, etc. I love them, you love them, everyone loves them. There is just one problem – none of the thousands of existing games would work on the iPhone even if Mobile Safari supported Flash perfectly!

The iPhone doesn’t have a keyboard, so most arcade-type games are right out. Even games that exclusively use the mouse would have problems since tapping your finger on the screen is much, much less precise than using a pointer. In addition, on the iPhone you effectively have multiple pointing devices – how would current Flash apps handle that?

For a quick demo of why sites like newsgrounds will never work on the iPhone, resize your browser window to 480*320 (or 320*480 since that is more usual) and visit your favourite gaming site. Now set your mouse pointer to a big white blob instead of an arrow to simulate tapping with a large figertip. Remember to stop playing after 45 minutes to replicate the battery drain. See how much fun you have.

Feb 132010
 

I have been doing some iPhone development lately. Nothing too amazing, just some test apps to get a feel for the system. Now, some people will tell you that Cocoa Touch is an API sent from God and frankly it is pretty good (especially given what passes for UI on other embedded devices), but that doesn’t mean it doesn’t have some annoyances.

Here is something that tripped me up for a while. The UIButton class has a property called titleLabel which (obviously) returns the UILabel that is used to display the text of the button. You can use this property to modify the parameters of the label, like so:

1
2
3
m_addButton.titleLabel.font = [UIFont systemFontOfSize: 7];
m_addButton.titleLabel.textColor = [UIColor blackColor];		 
m_addButton.titleLabel.textAlignment = UITextAlignmentRight;

What you can’t do is this:

1
m_addButton.titleLabel.text = @"Add Stuff";

Although nothing I have found in the documentation says so, the text of the button cannot be set from the titleLabel property. What you have to do is this:

1
[m_addButton setTitle:@"Add Stuff" forState: UIControlStateNormal];

Setting the title this way works, and has the advantage that you can specify different text for different states:

1
2
[m_addButton setTitle:@"Add Stuff" forState: UIControlStateNormal];
[m_addButton setTitle:@"Add Stuff (not now)" forState: UIControlStateDisabled];

This is perhaps not that interesting for text titles, but is an excellent way to control the image the button shows based on whether the button is enabled, highlighted, and/or selected.

Feb 032010
 

Following up on the epic 10 minute rap summary of Robocop, the same team has released Aliens:


open at youtube.com

Watching this reminds me what a great film Aliens turned out to be and how Avatar (by the same director) pales in comparison. It’s not that Avatar was terrible but nobody is going to be making 10 minute rap songs about it in 25 years.

quick update: Hey, they’ve done Terminator 2 as well!