iPhone: how to create a transparent table header
A couple of weeks ago I was wondering how you created a transparent header for a table view on the iPhone like the one that’s in the built in contacts app detail view. Here’s a video of the contacts app so that you can see what I’m trying to achieve:
Initially, I thought that the way to do this was to add an additional section to the table and add a custom cell to it. That kind of works, but is quite hard work. I think I’ve found a better and simpler way – by using the tableView:viewForHeaderInSection method on UITableViewDelegate.
To start with, we need to create a basic view-based Cocoa Touch app in XCode. I’ve called mine ContactStylee. I’ve zipped up the completed XCode project for you so that you can follow along.
There will be no “iPhone killer”
All you ever hear from the mobile phone manufacturers and pundits these days is speculation about what phone will “kill” the iPhone. I think this is evidence that they are thinking in a way that will be guarantee that they will be also-rans for as long as Apple make a mobile telephony device (and I think they’ll be doing that for a *long* time).
It shows that they’re asking the wrong question. The flurry of new touchscreen devices – the BlackBerry Storm, the LG Incite (tagline: “Windows Mobile at its most intuitive”, which is kind of like saying “shit at its least smelly”) and so on – show that the boards of mobile phone companies have, in effect, told their R&D teams to create an iPhone clone.
And there’s the problem. You can’t clone the iPhone, because Apple have done such an amazing job on the design, usability and functionality that, if you’re in the market for a touchscreen phone, you’re probably going to automatically choose an iPhone. And that’s before you’ve had a play with your friend’s iPhone. I’ve never owned any other device that has made my friends *laugh* when they see how awesome it is.
There are still a few things that might hold you back: years of hearing that Macs aren’t as good as PCs (just pop into your local Apple Store if you want to find out how wrong-headed that is), the price of the monthly contract, and maybe not wanting to be on O2 due to coverage issues in your area (or AT&T or whoever the carrier is in your country). And you may just not want to be a sheep. But once the exclusive deals expire, surely the iPhone will be available on all networks and most of those concerns will go away.
But there are still a huge number of people who are not in the market for an iPhone at all. People who don’t want such a large phone, who don’t want email, or an iPod on their phone, or a mobile gaming device, who probably don’t even need a camera, and who will probably never download apps. Although the iPhone has been a massive success – when very few predicted it would be – it still only has a fraction of the market for handsets.
I boldly predict that the next big-selling phone will be designed by people who look at the iPhone and ask: “who isn’t going to want one of these?”, “why?”, and “how can we build them a phone they *do* want?” Until then, Apple will continue to eat the establish players’ lunch.
Update: fixed silly typo
NSConference
I’ve recently taken some actual concrete steps to learn the iPhone SDK and Objective-C. So far it’s been very enjoyable, with only a couple of WTF moments.
The biggest change from using Visual Studio and .NET has been that the visual tools actually seem to work without screwing with your work. I’m not pushing it very hard yet, so that will probably change. I’m still nervous that I don’t understand the underlying serialization format.
I’ve been using Bill Dudney‘s Screenscasts on starting iPhone development, and his forthcoming iPhone development book, both from the Pragmatic Programmers, which have both been excellent. As a result I’ve got the basics of an iPhone app that I think could turn into something that people might actually want to install on their phones. There’s a lot of work to be done before I get to that stage, though.
In an attempt to give myself a hard deadline for learning, I also signed up for NSConference, a Mac developers conference to be held in April, organised by Scotty from the Mac Developer Network. If you’re at all interested in iPhone or Mac development it looks like the place to be. Hopefully I’ll see you there.
It’s official
I am the greatest. The iPhone said so:
And I didn’t Photoshop it, either.
iPhone development
Now this is very exciting.
I predict that the iPhone SDK will be seen as a watershed in the history of computing, as important as the the first PC. For the first time, proper mobile computing will be a reality.
I can’t wait to get started developing my first app.
The river of news is diverted
I made the difficult decision to change my RSS reader the other day from the lovely NewsFire to the newly free NetNewsWire. As it happens I actually have a licence for NNW from before it was made free but I didn’t like it enough and went back to NewsFire.
Today, I achieved the nirvana of a news reader with no unread items in it. I feel like I’ve had my house steam cleaned or something. I’m still not 100% sold on NNW, but, like NewsFire, its integration with my blog editor MarsEdit and my del.icio.us client Pukka is great and it has the killer feature of synchronising with Newsgator Online so that I can read feeds from my iPhone and keep the unread/read status consistent on my MacBook Pro and the phone.
I miss the beautiful interface and animations of NewsFire, but I fought the three-pane RSS reader for too long. I think I’ll be with NWW for a while. Maybe when David releases NewsFire 2 I’ll give it another look.
My iPhone – Week 1
We might as well get it out of the way early on: I adore my iPhone. Today my old number ported over (although with some weird side effects) and so I should be a one portable device man from now on.
As always with Apple it’s simple touches that make all the difference. The screen is really crisp and rendering in Safari is utterly brilliant – it’s even sharper than a MacBook Pro. The zoom in and out are just superb – you can’t keep the childlike smile off your face. The automatic orientation detection is lovely too.
There are, of course, some features that I want Apple to add. Top of the list is a to-do list app. Ideally, that would be OmniFocus when the SDK is available (any day now, hopefully). I’d like to be able to remove the idiotic Stocks widget from my home-screen. Even better, I’d like to rearrange the screen in any way I choose. For top marks, the list of widgets should sync between the phone and my MacBook Pro.
Next, I’d like an RSS reader – ideally NewsFire. Again, that should sync with my Mac. At a push I might be willing to swap to NetNewsWire if it synced properly.
Then, I’d like a mobile blogging app – ideally MarsEdit, which I’m using to write this post.
Syncing generally could be better – although it works very well when you have your iPod cable available, it should also work over .Mac so that I don’t ever need to physically connect it. That would take care of Calendars, Contacts, Mail Accounts, Bookmarks and Widgets.
The last thing that’s missing is Copy & Paste, although that’s rumoured to be included in the next software update.
But these are little gripes. The iPhone is the best device I’ve ever bought. Everyone should have one.
Getting WordPress, mod_rewrite and Leopard to work together
I’ve been trying to get Leopard, Apache 2 and WordPress working together for a while now. I want to use the WordPress friendly URL feature, and this requires the Apache mod_rewrite module to work too. There are various places around the web that have partial solutions to these problems. Here’s the procedure I followed – YMMV
First off, WordPress is installed in /Users/jameshiggs/Sites/blog. Leopard comes with Apache 2.2 installed, but has PHP disabled by default. To correct this, go to the console and change directory to /etc/apache2 and open httpd.conf in your favourite editor. For me this means typing:
sudo mate httpd.conf
You’ll probably have to enter your admin password. Find the line that reads:
#LoadModule php5_module libexec/apache2/libphp5.so
and uncomment it so that it looks like this:
LoadModule php5_module libexec/apache2/libphp5.so
Next, we need to make sure that your user directory allows .htaccess rules. To do this, create a file called jameshiggs.conf (obviously, you’ll need to replace my user name with yours) in /etc/apache2/users. The contents of that file should read:
<Directory "/Users/jameshiggs/Sites"> Options Indexes MultiViews AllowOverride All Order allow,deny Allow from all </Directory>
Again, you’ll need to replace my user name with yours.
The final piece of the jigsaw is to configure WordPress to use friendly URLs – which you do from the Options > Permalinks page. I’ve selected the second option which makes URLs look like this: http://localhost/~jameshiggs/blog/2007/12/25/sample-post/. If WordPress can write to the site root then it will automatically create the .htaccess file. If not, you’ll need to create it yourself in the root of your blog site. On my machine, the file should look like this:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /~jameshiggs/blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~jameshiggs/blog/index.php [L]
</IfModule>
Finally, you need to restart Apache – the easiest way to do that is to go to System Preferences > Sharing panel and untick Web Sharing. Once Apache has stopped, tick it again and Apache should start up. And that’s it.
Let me know if you have any variants to this procedure.
Thanks to Bagelturf and Ariadoss for hints that helped me get this running.
iPhone beats Windows Mobile in 5 short months.
Wow. The iPhone already has a greater share of the browser market than all Windows Mobile/CE devices combined. Windows CE is 10 years old, while the iPhone is just 5 months old.
(Via 9 to 5 Mac.)
Facebook and iPhoto
I’m probably the last person in the known universe to find out about this, but I’ve been very impressed recently with the Facebook iPhoto Exporter. It adds another tab to the Export dialog that lets you create albums, upload photos and tag your friends in them. Very slick.
Here’s what it looks like in practice (click for full-size):




