NSObject.ConformsToProtocol(IntPtr) 메서드

정의

이 개체가 지정된 프로토콜을 구현하는지 확인하기 위해 호출됩니다.

[Foundation.Export("conformsToProtocol:")]
[Foundation.Preserve]
public virtual bool ConformsToProtocol (IntPtr protocol);
abstract member ConformsToProtocol : nativeint -> bool
override this.ConformsToProtocol : nativeint -> bool

매개 변수

protocol
IntPtr

nativeint

프로토콜에 대한 포인터입니다.

반환

클래스가 프로토콜을 구현하는 경우 true를 반환해야 합니다.

구현

특성

설명

지정된 프로토콜을 구현하는지 여부에 대해 개체에 대한 Objective-C의 쿼리에 응답하기 위해 클래스가 필요한 경우 이 메서드를 재정의할 수 있습니다.

IntPtr 값을 지정한 프로토콜과 AdoptsAttribute를 만들고 ProtocolHandle을 가져온 결과와 비교할 수 있습니다.

static AdoptsAttribute myProtocol = new AdoptsAttribute ("MyProtocol");
public override ConformsToProtocol (IntPtr protocol)
{
	if (protocol == myProtocol.ProtocolHandle)
		return true;
	return false;
}

일반적으로 를 사용하여 클래스 AdoptsAttribute 를 디코레이트하고 다음과 같이 런타임에서 이 작업을 수행하도록 할 수 있습니다.

[Adopts ("UITextInput")]
[Register ("MyCoreView")]
public class EditableCoreTextView : UIView {
	[Export ("inputDelegate")]
	public UITextInputDelegate InputDelegate {...}
}

AdoptsAttribute의 전체 샘플은 SimpleTextInput 샘플을 참조하세요.

적용 대상