I recreated UIKit’s UITableView component in AS3 to give a Flash app that “iPhone-y feel”
I’m in the middle of working on an undisclosed project that we’re releasing on both Flash and iPhone simultaneously. It’s currently my job to work on the Flash part, and when that’s done I’ll be helping Cam on the iPhone side of things. We’ve decided to keep the design of both projects very similar, which means the Flash app has to look like a lot like the iPhone app.
As part of this process, I created an AS3 version of UIKit’s UITableView, the core component of almost every iPhone screen. It took me a while to get the feel of it right, but I think I’m pretty close now.
It has some neat features
- Dragging from anywhere, but only after a certain threshold
- Throwing and smooth deceleration
- Squishy “off-screen” tops and bottoms. Think Tweetie 2.
- Scrollbar with size relative to the visible area (including squishyness)
- Sticky headers that always stay at the top of the screen till you reach the next section
The API for it is pretty much identical to Apple’s UITableView. I’m using the delegation pattern(ITableViewDataSource, ITableViewDelegate, etc), and there’s even a “dequeueReusableCellForIndexPath” method. At this point, the code is still too under-construction to release it, but once this project is complete I’m going to clean it up and make it available for anyone to use.
So what you’re saying is your Flash app will feel like a big phoney?