Skip to content

Instantly share code, notes, and snippets.

@berikv
Created February 20, 2015 10:55
Show Gist options
  • Select an option

  • Save berikv/73b10288c87922fa0a2f to your computer and use it in GitHub Desktop.

Select an option

Save berikv/73b10288c87922fa0a2f to your computer and use it in GitHub Desktop.
LLDB helper for printing the position of a view inside it's window
(lldb) posinwindow 0x796a0e60
(CGPoint) $58 = (x=711, y=205.5)
#!/usr/bin/python
import lldb
import fblldbbase as fb
def lldbcommands():
return [ PrintPositionInWindow() ]
class PrintPositionInWindow(fb.FBCommand):
def name(self):
return 'posinwindow'
def description(self):
return """Returns the position of this view in it's current window"""
def run(self, arguments, options):
view = arguments[0]
lldb.debugger.HandleCommand('p (CGPoint)[(UIView *)%s convertPoint:((CGRect)[(UIView *)%s bounds]).origin toView:(UIWindow *)[(UIView *)%s window]]' % (view, view, view))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment