Archive for the ‘Team building’ Category.

Custom UISearchBar as a header view of UITableView in IB

If you add a UISearchBar to your UITableView in Interface Builder, it gives you a nice way to put the search bar as the header view of your table view, without any extra work involved such as creating the search bar in code and setting it up as a header view of the table. (OK, it is true that this is not that much more work, but I am super lazy.)

This works great if you want to use the search bar as is, without being able to customize it at all, which includes resizing it and adding additional controls to it.

My current needs dictated that I needed to add a bar code button to the right of the search bar that the user can use to scan in a bar code and kick off a search for the encoded data. I was going for the look of the search bar that is in the eBay iPhone app.

After many tries at subclassing UISearchBar and overriding drawRect and layoutSubviews in every perverted way possible, I stumbled on this Stack Overflow question and solution:

Changing the size of the UISearchBar TextField?

Basically, what you do here is to add a UIView to the table view instead of a UISearchBar. Then, you add a UINavigationBar to the UIView, and then resize it so that it only takes up a small portion of the view. After this, then you would add a UISearchBar to the empty space in your UIView, and then adjust the size of the UISearchBar to just fill up that empty space. (The navigation bar keeps the color gradient consistent across the header view.) And finally, you can then add any controls you want to the space that the small navigation bar occupies.

The only problem with this is that you have to manually manipulate the position of the new controls, as if you try to drag and drop, you might add the control as a UINavigationItem in the UINavigationBar.

On a conference note, I got tickets for myself and my co-workers to Stir Trek (The Avengers Edition) today a few minutes after they went on sale. Which is a good thing, as I understand they sold out in less than 15 minutes. I attended last year and had a good time, and I am hoping that this year’s edition has a better movie than last year’s Thor Edition. (Unfortunately, Thor does appear in The Avengers.)

BTW, happy Pi day everyone!

Some people use QWERTY, some Dvorak, but I use TVQUIZ

Are you looking for something silly and not too sinister to pull on a coworker who takes a week’s vacation on the beach while you are stuck in the office dealing with customers having issues with the vacationer’s product? And did I mention the week in question is one of the busiest weeks of the year for our company?

Here’s what I did to his keyboard:


He had to rearrange a few of the keys to make it workable again, as this Dell keyboard has different shapes of the keycaps for the different rows of the keyboard. This took me about 10 minutes, and was much cheaper and quicker than wrapping everything in his office in aluminum foil.

A whole year of more randomer-ness

Today is the 1 year anniversary of a snippet of our company’s code being featured on The Daily WTF web site.  Here is a direct link to the article so you too can bask in the goodness of real randomicity:

More Randomer

So I bought cupcakes for our dev team and decided to hack one of the cupcakes:

More Randomer's First Birthday

By the way, the developer that created the code in question is no longer at the company.

Terminator Salvation movie night

We went out after work today to take in the newest installment of the Terminator saga, Terminator Salvation. The movie itself was somewhat disappointing, but as a team building exercise, the camaraderie was worth the effort.

I have a theory about movies. The ability for a movie to interest viewers with plot and conflict is inversely proportional to the amount of special effects. Terminator Salvation does nothing to refute my postulate.