MKPinAnnotationView 建構函式

定義

多載

名稱 Description
MKPinAnnotationView(CGRect)

以指定的框架初始化 MKPinAnnotationView。

MKPinAnnotationView(NSCoder)

一個建構器,能從未封存物件中儲存的資料初始化物件。

MKPinAnnotationView(NSObjectFlag)

用來呼叫衍生類別跳過初始化,僅僅配置物件。

MKPinAnnotationView(NativeHandle)

一種用於建立未受管理物件的受管理表示的建構器。 由執行時呼叫。

MKPinAnnotationView(IMKAnnotation, String)

MKPinAnnotationView(CGRect)

以指定的框架初始化 MKPinAnnotationView。

[Foundation.Export("initWithFrame:")]
[ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)]
public MKPinAnnotationView(CoreGraphics.CGRect frame);
[<Foundation.Export("initWithFrame:")>]
[<ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)>]
new MapKit.MKPinAnnotationView : CoreGraphics.CGRect -> MapKit.MKPinAnnotationView

參數

frame
CGRect

視圖使用的框架,以 iOS 點數表示。

屬性

備註

此建構器用於程式化建立一個具有指定框架維度的 MKPinAnnotationView 新實例。 該物件只有在包含檢視中呼叫 AddSubview 加入檢視階層後才會顯示。

當從故事板或 XIB 檔案反序列化物件時,不會呼叫此建構子;取而代之的是,會呼叫取 NSCoder 參數的建構子。

適用於

MKPinAnnotationView(NSCoder)

一個建構器,能從未封存物件中儲存的資料初始化物件。

[Foundation.Export("initWithCoder:")]
[ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)]
[ObjCRuntime.DesignatedInitializer]
public MKPinAnnotationView(Foundation.NSCoder coder);
[<Foundation.Export("initWithCoder:")>]
[<ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)>]
[<ObjCRuntime.DesignatedInitializer>]
new MapKit.MKPinAnnotationView : Foundation.NSCoder -> MapKit.MKPinAnnotationView

參數

coder
NSCoder

unarchiver 物件。

屬性

備註

此建構子的目的是允許從非歸檔器初始化類別(例如在 NIB 反序列化期間)。 這是協議的一部分 NSCoding

如果開發者想建立此物件的子類別並持續支援從壓縮檔反序列化,他們應該實作一個具有相同簽名的建構子:取一個型別 NSCoder 為 的單一參數,並以 [Export("initWithCoder:"] 屬性裝飾它。

此物件的狀態也可透過伴 EncodeTo(NSCoder) 隨方法序列化。

適用於

MKPinAnnotationView(NSObjectFlag)

用來呼叫衍生類別跳過初始化,僅僅配置物件。

[ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)]
protected MKPinAnnotationView(Foundation.NSObjectFlag t);
[<ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)>]
new MapKit.MKPinAnnotationView : Foundation.NSObjectFlag -> MapKit.MKPinAnnotationView

參數

t
NSObjectFlag

未使用的哨兵值,通過NSObjectFlag。空。

屬性

備註

當衍生類別在受管理程式碼中完全建構該物件,並僅希望執行時能配置並初始化 。NSObject 這是實作 Objective-C 所使用的兩步驟初始化流程所必需的,第一步是執行物件配置,第二步是初始化物件。 當開發者呼叫此建構子時,他們利用一條直接路徑,一路延伸至 , NSObject 僅分配物件的記憶體並將 Objective-C 與 C# 物件綁定在一起。 物件的初始化由開發者決定。

此建構子通常由綁定產生器用來分配物件,但阻止實際初始化的進行。 一旦配置完成,建構子必須初始化該物件。 對於由綁定產生器產生的建構子,這表示它會手動呼叫其中一個「init」方法來初始化物件。

如果開發者用這個建構子鏈鏈鏈,完全初始化物件是他們的責任。

一般而言,如果開發者的建構子呼叫對應的基礎實作,也應該呼叫一個 Objective-C 初始化方法。 如果不是這樣,開發者應該直接連結到類別中的正確建構子。

參數值被忽略,僅確保唯一執行的程式碼是建構階段,即基本 NSObject 配置與執行時類型註冊。 通常連鎖方式會是這樣:

//
// The NSObjectFlag constructor merely allocates the object and registers the C# class with the Objective-C runtime if necessary.
// No actual initXxx method is invoked, that is done later in the constructor
//
// This is taken from the iOS SDK's source code for the UIView class:
//
[Export ("initWithFrame:")]
public UIView (CGRect frame) : base (NSObjectFlag.Empty)
{
    // Invoke the init method now.
    var initWithFrame = new Selector ("initWithFrame:").Handle;
    if (IsDirectBinding) {
        Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSend_CGRect (this.Handle, initWithFrame, frame);
    } else {
        Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_CGRect (this.SuperHandle, initWithFrame, frame);
    }
}

適用於

MKPinAnnotationView(NativeHandle)

一種用於建立未受管理物件的受管理表示的建構器。 由執行時呼叫。

[ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)]
protected internal MKPinAnnotationView(ObjCRuntime.NativeHandle handle);
[<ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)>]
new MapKit.MKPinAnnotationView : ObjCRuntime.NativeHandle -> MapKit.MKPinAnnotationView

參數

handle
NativeHandle

指向未管理物件的指標(handle)。

屬性

備註

此建構子由執行環境架構(GetNSObject(IntPtr))調用,以建立指向非管理 Objective-C 物件指標的新受管理表示法。 開發者不應直接呼叫此方法,而是應 GetNSObject(IntPtr) 呼叫,因為它能防止兩個受管理物件指向同一原生物件的實例。

適用於

MKPinAnnotationView(IMKAnnotation, String)

[Foundation.Export("initWithAnnotation:reuseIdentifier:")]
[ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)]
public MKPinAnnotationView(MapKit.IMKAnnotation? annotation, string? reuseIdentifier);
[<Foundation.Export("initWithAnnotation:reuseIdentifier:")>]
[<ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)>]
new MapKit.MKPinAnnotationView : MapKit.IMKAnnotation * string -> MapKit.MKPinAnnotationView

參數

annotation
IMKAnnotation
reuseIdentifier
String
屬性

適用於