【问题标题】:MonoTouch equivalent of transform.b and transform.a?MonoTouch 相当于 transform.b 和 transform.a?
【发布时间】:2012-03-23 04:39:24
【问题描述】:

iOS 有一个关于“b”和“a”转换的属性。示例 iOS 代码如下。什么是 mono/monotouch 等价物?

CGFloat radians = atan2f(container.transform.b, container.transform.a);

【问题讨论】:

    标签: c# ios xamarin.ios transform cgaffinetransform


    【解决方案1】:

    Apple 的CGAffineTransform 用字母定义:a、b、c、d 表示它的矩阵成员(翻译部分除外)。

    struct CGAffineTransform {
        CGFloat a;
        CGFloat b;
        CGFloat c;
        CGFloat d;
        CGFloat tx;
        CGFloat ty;
    };
    

    同时 MonoTouch 使用更类似于 .NET(例如 System.Drawing)的命名:xx、yx、xy、yy。

    public struct CGAffineTransform {
       public float xx;   // a
       public float yx;   // b 
       public float xy;   // c
       public float yy;   // d
       public float x0;   // tx
       public float y0;   // ty
    }
    

    这使得移植现有 C# 代码变得更加容易。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-24
      • 2011-07-01
      相关资源
      最近更新 更多