2014-03-03 28 views
-1

我在嘗試將一個開放源代碼彈出菜單從Objective-C轉換爲Xamarin。目前我遇到的問題是Obj-C代碼使用CGRectInfinite創建一個幀。這在MonoTouch中似乎不可用,通過通常的RectangleF類。有其他選擇嗎?MonoTouch/Xamarin中CGRectInfinite&CGRectIsInfinite的等價形式

類似地,在RectangleF中似乎沒有出現CGRectIsInfinite等價物。如果有的話,什麼是替代方案?

回答

1

第一添加這個using語句:

using MonoTouch.CoreGraphics; 

然後你可以用這個測試:

public static RectangleF GetInfinite() 
{ 
    var image = CIImage.EmptyImage; 

    if (image.Extent.IsInfinite()) 
    { 
     return image.Extent; 
    } 

    throw new Exception ("Unable to create infinite rect"); 
} 
+0

這是IsInfinite()方法。 'image.Extent'是一個RectangleF。 – SKall