휴대용 라이브러리에서 System.Drawing 형식을 사용할 수 있도록 splat 라이브러리 https://github.com/paulcbetts/splat을 사용하는 Xamarin.iOS 프로젝트가 있습니다. 부모 클래스가 System.Drawing.RectangleF를 사용한다면, Splat을 사용하여 Xamarin.IOS 코드에서이 클래스의 서브 클래스를 작성하면됩니다. 그러나 Xamarin.Mac도 마찬가지입니다. 적어도 내가하는 방식은 아닙니다. 다양한 유형이 자신과 충돌합니다 (최소 Point 및 RectangleF).Splat 라이브러리 및 Xamarin.Mac을 사용한 형식 확인
이것이 Xamarin의 최근 업데이트 (Xamarin 6에 대한 업데이트)와 관련이 있는지 여부는 알 수 없습니다.
일부 샘플 코드는 아래에 있으며 Github에서 사용할 수있는 문제를 보여주는 전체 프로젝트를 만들고 있습니다. https://github.com/verybadcat/splat - macbug 지점.
여기에 설명 된 문제와 유사합니다 [Splat [0.3.4] on Xamarin.iOS: issues with RectangleF and PointF].
휴대용 클래스 라이브러리 프로젝트 :
이using System.Drawing;
namespace PCL
{
public class RectOwner
{
public RectangleF Rect { get; set;}
}
}
IOS 프로젝트 -이 잘 작동 :
는using PCL;
namespace IOSApp
{
public class RectOwnerIOS: RectOwner
{
public RectOwnerIOS()
{
this.Rect = new System.Drawing.RectangleF (10, 20, 30, 40);
}
}
}
맥 프로젝트 - 빌드하지 않습니다
using PCL;
namespace MacApp
{
public class RectOwnerSubclass: RectOwner
{
public RectOwnerSubclass()
{
this.Rect = new System.Drawing.RectangleF (5, 6, 7, 8); // errors here:
// /Users/william/Documents/splat/MacApp/RectOwnerMac.cs(16,16): Error CS7069: Reference to type `System.Drawing.RectangleF' claims it is defined assembly `Splat, Version=1.6.2.0, Culture=neutral, PublicKeyToken=null', but it could not be found (CS7069) (MacApp)
// /Users/william/Documents/splat/MacApp/RectOwnerMac.cs(23,23): Error CS0029: Cannot implicitly convert type `System.Drawing.RectangleF [Xamarin.Mac, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]' to `System.Drawing.RectangleF [Splat, Version=1.6.2.0, Culture=neutral, PublicKeyToken=null]' (CS0029) (MacApp)
}
}
}
을 어떻게 할 수 Mac 프로젝트를 구축 하시겠습니까?
나는 다운 그레이드 :
당신이 XM 4.5 대상 프레임 워크에 포트 경고등하려고하면 다양한 기존의 SD 유형이 정의 추론하기 때문에, 당신은 OpenTK에서 끌어해야합니다, 메모를 수행 Xamarin Studio 5.10 및 해당 Xamarin.Mac 버전. 나는 아직도 실패를 본다. –