Skip to content

Instantly share code, notes, and snippets.

@takuma104
Created March 1, 2009 19:13
Show Gist options
  • Select an option

  • Save takuma104/72441 to your computer and use it in GitHub Desktop.

Select an option

Save takuma104/72441 to your computer and use it in GitHub Desktop.
# subview walker for iphone-rubycocoa
def walk(v, g)
g[:subviews] = v.subviews.to_a.map {|sv| walk(sv, geom(sv))}
g
end
def geom(v)
{:name=>v.to_s, :subviews=>[], :frame=>v.frame.to_a}
end
root = OSX::UIApplication.sharedApplication.keyWindow
walk(root,geom(root))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment