【问题标题】:iPhone: How to get top left corner coordinate of a UIView?iPhone:如何获取 UIView 的左上角坐标?
【发布时间】:2010-12-29 02:08:06
【问题描述】:

我只想获取视图左上角的 x,y 坐标,我该怎么做? 谢谢!

【问题讨论】:

    标签: iphone objective-c cocoa-touch


    【解决方案1】:
    CGPoint topLeft = theView.frame.origin;
    

    【讨论】:

    • 知道如何获取 visibleMapRect 的角坐标吗?
    • SKScene 的 @Jonathan Grynspan self.frame.origin 位于左下方。
    【解决方案2】:

    这是左下角--->CGPoint topLeft = theView.frame.origin;

    左上角是:

    CGPoint topLeft = theView.frame.origin+theView.frame.height;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-09
      • 1970-01-01
      相关资源
      最近更新 更多