Exploring iPhone view hierarchies

November 20th, 2009

Sometimes it’s useful to quickly see all the subviews of an iPhone view.

Perhaps you’re debugging a problem in one of your views or trying to understand the inner workings of one of the built in views.

You can simply iterate over a view’s subviews, but then you won’t see subviews deeper than one level. You need a method that recursively walks the hierarchy.

Luckily Apple has already done this with an undocumented UIDebugging category on UIView that makes this very easy: recursiveDescription

At the gdb prompt in the Xcode debugger you can say:

p [[self view] recursiveDescription]

and instantly see a description of the entire view hierarchy.

Follow us on Twitter

Removing Twitter followers

September 28th, 2009

Did you know that it’s possible to remove someone from your followers without blocking them?

Normally when you visit your list of followers these are the options available to you:

No Remove option
But after you protect your twitter account and mark it private, the options change to include the remove option:

Remove a follower

Selecting “Remove” shows this alert and after you click OK, poof that user is no longer following you:

Confirm removing a follower

This nifty option is also available from the API, though it is undocumented:

curl -u user:password -d ” http://twitter.com/friendships/destroy/59648642.xml

Here is a patch to John Nunemaker’s Twitter gem that adds this functionality:

module Twitter
  class Base
    def friendship_remove(id)
      perform_post(”/friendships/remove/#{id}.xml”)
    end
  end

And here is a quick Ruby Script that removes all the followers of a user:

#!/usr/bin/ruby -rubygems
require ‘twitter’

module Twitter
  class Base
    def friendship_remove(id)
      perform_post(”/friendships/remove/#{id}.xml”)
    end
  end

auth = Twitter::HTTPAuth.new(’user’, ‘password’)
twitter = Twitter::Base.new(auth)

twitter.follower_ids.each do |follower_id|
  begin
    twitter.friendship_remove(follower_id)
  rescue => err
    puts “#{err} for follower #{follower_id}”
    next
  end
end

Follow us on Twitter

Twitter now supports @ symbol in URLs

September 17th, 2009

It looks like Twitter is making lots of little changes on their site.

They’ve added new colorful default profile imagesrolled out some design tweaks and now they allow the @ symbol in URLs.

Previously if you tried twitter.com/@boctor or twitter.com/@tweetslounge you’d get an error. But now that link works just fine.

Handy for those times you’re copying and pasting and accidentally keep the  symbol

A welcome change from the brown!

Follow us on Twitter

New Twitter profile images

September 15th, 2009

If you’ve used Twitter at all you’ve seen the original default profile image that Twitter assigns you when you first join:

Default Profile Image

Now it looks like along with their home page redesign they have a set of new images. It appears that the colors are randomly assigned:



Default profile 1 Default profile 2 Default profile 3
Default profile 4 Default profile 5 Default profile 6



A welcome change from the brown!

Follow us on Twitter

Tweets Lounge

September 3rd, 2009

I’m happy to announce my new side project: Tweets Lounge.

Tweets Lounge is a directory of local neighborhood businesses using Twitter. It’s like a Yelp directory for Twitter.

We’re initially supporting Seattle and the surrounding area, but we plan on expanding to other cities soon. Check out the site: http://tweetslounge.com and follow us at @TweetsLounge.