UITableViews do not properly animate on an Airplay secondary screen

A few weeks back I ran into an interesting UITableView bug and I finally got around to writing up a test case and submitted a Radar to Apple. The test application source is on my GitHub and I've copied the radar to Open Radar.

I'm working on an app right now that has the option of driving a second screen. There are two methods of connecting such a screen: using a special dock cable to physically connect a monitor; and using Airplay to connect to an Apple TV device and using that screen.

Note that I'm not talking about mirroring the iPad display to the second display, I'm talking about having a completely different UIView on the second display. (This is confusing because iOS calls turning that on "Airplay Mirroring" although it's entirely up to the application whether it actually mirrors the main view or not.)

This second display is primarily a UITableView and it can potentially have quite a few rows to display. Also the intent is to have a screen that can be read at a distance so I use quite a large font (the current "large" size font is 36 point.) Since there's no touch UI there's no way for the user to directly scroll the secondary display but the app scrolls the second display to match a similar table on the iPad display. As the user manipulates the main display the secondary screen scrolls in unison. Well, at least it should and that right there is the bug. In my experience any UITableView method call that takes an animated: parameter does not animate on the Airplay secondary screen if animated: is set to YES. This works fine on the physical secondary screen, but not the Airplay. For example scrollToRowAtIndexPath:atScrollPosition:animated: will silently fail if you try to animate it.

There's also a workaround I have, and you can see it in the code on GitHub. Short form is this: animating the contentOffset value of the table in a GCD block via [UIView animateWithDuration:delay:options:animations:completion] works. So instead of simply scrolling to a row, I calculate a contentOffset for that row and scroll the underlying UIScrollView.

I was not able to find any references to this bug anywhere via Google so I'm not sure it's been reported before. If you want to animate a UITableView on an Airplay secondary screen you probably want to take a look at the GitHub repository.

Podcast Recommendation: Polygon's The Besties

Hey you! Do you like video games? Do you like jokes? Then you might well like The Besties podcast from Polygon. It's weekly and runs about 45 minutes or so for each episode. It sort of snuck up on me in that I enjoyed it at first but I realized this week that it's really become one of my favorite podcasts.

Here's the idea: four guys from Polygon each bring a game they want to be Game of the Week and they pitch the games to each other. After picking a winner for the week they compare it to the current "Bestie" to see if it dethrones the previous winner.

So far so good, and they do genuinely bring games that I've bought and enjoyed, but the the part that really elevates it is that the whole thing is done tongue–in–cheek. For example one of the early winners was the new SSX game and the reason they gave it the prize was that it supported racing against a previously saved ghost and therefore if your Dad had raced a game and then died you could play SSX with your dead Dad, thus keeping him alive. SSX was dethroned by Journey because Journey lets you play cooperatively online with somebody you don't know and has no voice chat so it was possible that somebody from Israel could play with somebody from Palestine and thus bring peace to the Middle East. (Journey was recently dethroned because it had two months on top and failed to deliver the promised world peace.)

So yeah, I like it. It's a good blend of game reviews and jokes. Check it out!

Tonx Coffee

My relationship with coffee has evolved over the years. Most blog readers probably associate me with carrying a big-ass vacuum thermos of coffee into work and drinking it over the course of a day. And almost never washing out my coffee mug. If that's your impression it might astonish you to hear that many days now I only have a single cup (not mug, single cup) of coffee and at most I have two cups in a day. For a while I had a Senseo (there was a post about that back on Pic-A-Day when I ran that) and nowadays I use plain old French press which just generates a cup or so. I ultimately bought a larger French press that can make three cups at once for when I have guests who want coffee but now I just make one cup, then drink one cup. Simple.

Reasons? Well the reasons are legion. I'm more caffeine sensitive now. I suspect that's a mix of drinking less coffee and getting older but it's tough to separate the two there. If you know me as that "drinking a pot from a thermos" guy you also know me as a the guy who pops Tums all days. Guess what? Less black coffee means less stomach acid. Science! Also as I wrote on the defunct photo-blog I got weirdly OCD about "if I brew a pot of coffee I drink the whole thing". Switching to the Senseo meant I brewed coffee one cup at at time so drinking the "whole thing" was no longer a deal, but it also meant I was drinking mediocre coffee. Switching to the French press meant I could make good coffee and still only make one cup at a time.

OK, swell. Now I just need coffee beans. For a while I was trekking up to Orchard Valley Coffee to buy beans but that's a whole drive and crosses the 17 traffic and can be icky at the wrong time of day. Then for quite a long time I went to the local coffee shop (Lime Tree Espresso) that sources beans from Barefoot Coffee. This was a Good System™. Problem is that the local store is pretty much a one–man shop and sometimes he is just closed unexpectedly. About three weeks ago I went one day and found out he had started closing Tuesdays at noon. I went Wednesday at 2 PM and he was just "out until 2:30". At which point I had to go buy Cthulhu–knows–how–old Peet's beans from the Safeway. Enough. It's 2012, can't I just buy good coffee beans from Amazon and have somebody ship them to my hermetically sealed house of Board Games 'n Code Development™?

Well I didn't actually check on Amazon but the answer is yes! You can get 12 ounces of quality fresh-roasted beans shipped to you every two weeks from Tonx. But don't use that link use my pyramid scheme link a bit later. It will save you $10!

I just got my second shipment from Tonx this week and opened it up today. I have to say, I'm really pleased. 12 ounces/2 weeks is at least really close to my coffee bean consumption and I like the coffee just fine. It's within a buck or so of what I was paying at the local shop and I don't have to drive out and there and hope he's open.

So there you are. If you like quality coffee I'd recommend checking out Tonx. If you want to give it a try use this link. You get $10 off your first month and I think if three people use that link I get a free T-shirt. Or something like that. Anyway it's good coffee. Check it out.

Road Trip is Available!

Hooray! Road Trip is available in the App Store now for iPhone, iPod Touch, and iPad.

App Store Link

I don't know that I've ever really written down the story behind Road Trip so now is as good a time as any. Set the wayback machine to August 2008! Apple had just updated what was still known as iPhone OS into version 2.0 with the App Store allowing third party development. I had picked up an iPhone in March but had found at the time that iPhone development was limited. Apple considered it a beta and getting the keys that let you put an application on the hardware was at their discretion and I wasn't invited to the party. So around July or so I had acquired the necessary certificates and was trying to figure out what my "Hello World" learner app would be.

By this point the Big Honkin' Road Trip (BHRT) was well established. A group of friends from my Kesmai days would gather somewhere and we'd travel around hanging out and visiting various local HOOTERS. Usually we tried to find a state where there on the order of three – six restaurants and visit them all, thus completing the HOOTERS of (state) tour. Our process for handling this was a little complex. Sometimes there would be a car rental, sometimes we'd have somebody's vehicle(s). There would be hotel rooms, there would be gas costs, there would be bar/food tabs. As different people paid for different items we'd constantly be passing back and forth cash as we tried to pay for things evenly. Mind you, sometimes we'd have six people on the trip with one or two others showing up for one stop or another. Plus there was drinking. We'd have somebody staying sober to drive, but that wasn't always the person tracking the cash. There were always these crummy morning reconciliation sessions where we'd dig up receipts and try to reconstruct who owed whom what. The previous BHRT I had used an OmniOutliner document to track every receipt and all of the outstanding debts. It worked but it was still a pain.

For some reason while Karin and I were at PAX in August it hit me: I could put an app on my iPhone to do all of this. At this point I had one week to write the app. This was the first version of Road Trip. I worked on it at PAX a bit, and wrote the vast bulk of it on my flight from California to Dulles to start BHRT2K8. It wasn't quite ready that night and I have some humorous memories of frantically debugging the math in Tony's car on Saturday morning because we needed the app to work before I started drinking. We all agreed that after I had been drinking I wasn't allowed to tweak our key financial instrument – this was really a refinement of an old MAMBA Kings rule where we could code after drinking at Fridays After Five (a little civic party that would happen in the summer that was a couple of blocks from our offices) but we never committed code until a sober review. (Indeed, you can see my key observation about that debugging session in a post on this blog.)

The UI for that version of Road Trip was hideous. It had this tabbed interface with no graphics, the first version couldn't handle splitting things non-evenly, there was some terribly confusing debt/payment nomenclature that was overly complex, and it was ugly as sin. But it worked. You could tell it "Oh Tony paid for a hotel room that Tim and Tony are splitting" and it would tell you how much each person owed each other. The core idea was offsetting debts: if I owed Tony $90 for a hotel room and I picked up a lunch tab so Tony owed me $45 then I'd still owe Tony $45. Now if there's a third person in that mix the numbers got more complicated but the app didn't care. It would tell you who owed the most money and they picked up the next tab. That would likely change the "Deadbeat" and we'd rinse and repeat. On the last stop of the trip we'd settle up and that would be the only time cash would have to change hands. We usually didn't have anyone owe more than $50 or so.

We used that version of Road Trip for several BHRT's and it slowly got more features, but was still ugly as hell and complicated. I was busy doing other paying work so Road Trip never got a through work over and I was never convinced there was much market for the application. Our trip to PAX East last year wasn't technically a BHRT but we did use Road Trip for settling debts.

OK, so last year my paying work stopped and I didn't have a great lead for something new. I decided to do iOS work and at that point why not dust off Road Trip and ship it? Maybe it won't be a big hit, but it's mostly done right?

Well, no. iPad had happened between 2.0 and 4.x and it really ought to be a Universal app. And the UI was just awful. And it really should have a map view, and maybe something about photos? Really the only thing that salvageable was the core math crunching. So the ugly Road Trip became Road Trip Classic and I started a new project, using iOS 5.0 (then in beta) and embarked on learning storyboards, the new iPad UI elements, and generally modernizing it.

And here we are way too many months later! I like the new UI and it even has some pretty textures evoking the key conceits of the app: money and roads. Maybe somebody will find this app useful, and at the very least we'll have an easy–to–use version for the next BHRT …

If you (or somebody you know) would find the app useful please check it out!

Bring me your comments, yearning to be free!

In the comments thread over on the X-Com post Tony mentioned that there was an annoying CAPTCHA that you had to pass in order to post a comment. I don't see that because I have an account on the site so I'm not considered an anonymous commenter. I can't find a setting to turn off the CAPTCHA but I can have up to 250 accounts on my current plan. I can make accounts that let you login and post comments without hassling about who you are. Tony beta–tested this and it seems to work well. However, what I can't provide on my current plan is a form where you sign up for an account. So. We don't' see a ton of traffic on this blog and I suspect I can keep up with requests for accounts. If you'd like to post a comment drop me a line and I'll get you squared away. If you don't have an email address for me there's a form in the sidebar on the right that you can use to contact me.

I should note that I'm not doing anything to remove the old "anonymous" comment system, so if you're posting a one-off comment and would prefer to use that go ahead. It just turns out that if you're likely to make multiple comments over time that it's a bit friendlier to get an account here and avoid the rigamarole. It's a new option, not a replacement of the old system.