今天在用Xamarin 写ios 的程序的时候,
RectangleF viewFrame = this.View.Frame;
RectangleF buttonFrame = new RectangleF(10f, viewFrame.Bottom - 200f, viewFrame.Width - 20f, 50f);
程序报错,原因是因为 this.View.Frame 是 CoreGraphics.CGRect 类型, 而 RectangleF 是 System.Drawing.RectangleF 类型,导致转换错误, 然后,我翻教程,网络找文档,都OK 啊,最后一篇 http://kerry.lothrop.de/unified-api-for-xamarin-ios/文档拯救了我,原因是因为版本不一致导致的, 正确写法
CoreGraphics.CGRect viewFrame = this.View.Frame; CoreGraphics.CGRect buttonFrame = new CoreGraphics.CGRect(10f, viewFrame.Bottom - 200f,viewFrame.Width - 20f, 50f);