共用方式為


UILocalizedIndexedCollation 建構函式

定義

多載

UILocalizedIndexedCollation()

預設建構函式,初始化這個類別的新實例。

UILocalizedIndexedCollation(NSObjectFlag)

在衍生類別上呼叫的建構函式,以略過初始化,並只配置 物件。

UILocalizedIndexedCollation(IntPtr)

建立 Unmanaged 物件的 Managed 標記法時所使用的建構函式;由執行時間呼叫。

UILocalizedIndexedCollation()

預設建構函式,初始化這個類別的新實例。

[Foundation.Export("init")]
public UILocalizedIndexedCollation ();
屬性

適用於

UILocalizedIndexedCollation(NSObjectFlag)

在衍生類別上呼叫的建構函式,以略過初始化,並只配置 物件。

protected UILocalizedIndexedCollation (Foundation.NSObjectFlag t);
new UIKit.UILocalizedIndexedCollation : Foundation.NSObjectFlag -> UIKit.UILocalizedIndexedCollation

參數

t
NSObjectFlag

未使用的 sentinel 值,傳遞 NSObjectFlag.Empty。

備註

當衍生類別完全建構 Managed 程式碼中的物件,而且只想要執行時間配置和初始化 NSObject 時,應該呼叫這個建構函式。 若要實作 Objective-C 所使用的雙步驟初始化程式,第一個步驟是執行物件配置,第二個步驟是初始化物件。 當開發人員叫用採用 NSObjectFlag.Empty 的建構函式時,會利用直接路徑,一路前往 NSObject,只設定物件的記憶體,並將 Objective-C 和 C# 物件系結在一起。 物件的實際初始化是由開發人員決定。

系結產生器通常會使用此建構函式來設定物件,但會防止實際初始化發生。 配置完成後,建構函式必須初始化 物件。 使用系結產生器所產生的建構函式,這表示它會手動叫用其中一個 「init」 方法來初始化 物件。

如果開發人員使用 NSObjectFlag.Empty 路徑鏈結,則開發人員必須負責完全初始化物件。

一般而言,如果開發人員的建構函式叫用 NSObjectFlag.Empty 基底實作,則應該呼叫 Objective-C init 方法。 如果這不是這種情況,開發人員應該改為鏈結至其類別中的適當建構函式。

會忽略引數值,而且只會確保唯一執行的程式碼是建構階段是基本的 NSObject 配置和執行時間類型註冊。 一般而言,鏈結看起來會像這樣:

//
// The NSObjectFlag merely allocates the object and registers the
// C# class with the Objective-C runtime if necessary, but no actual
// initXxx method is invoked, that is done later in the constructor
//
// This is taken from Xamarin.iOS's source code:
//
[Export ("initWithFrame:")]
public UIView (System.Drawing.RectangleF 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);
}

適用於

UILocalizedIndexedCollation(IntPtr)

建立 Unmanaged 物件的 Managed 標記法時所使用的建構函式;由執行時間呼叫。

protected internal UILocalizedIndexedCollation (IntPtr handle);
new UIKit.UILocalizedIndexedCollation : nativeint -> UIKit.UILocalizedIndexedCollation

參數

handle
IntPtr

nativeint

指標 (處理 Unmanaged 物件的) 。

備註

執行時間基礎結構會叫用此建構函式 (GetNSObject(IntPtr)) ,為 Unmanaged Objective-C 物件的指標建立新的 Managed 標記法。 開發人員不應該直接叫用這個方法,而是應該呼叫 GetNSObject 方法,因為它會防止 Managed 物件的兩個實例指向相同的原生物件。

適用於