Edytuj

Udostępnij za pośrednictwem


NSObject.SetValueForKeyPath Method

Definition

Overloads

SetValueForKeyPath(IntPtr, NSString)

A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

SetValueForKeyPath(NSObject, NSString)

Sets the value of a property that can be reached using a keypath.

SetValueForKeyPath(IntPtr, NSString)

A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

public void SetValueForKeyPath (IntPtr handle, Foundation.NSString keyPath);
member this.SetValueForKeyPath : nativeint * Foundation.NSString -> unit

Parameters

handle
IntPtr

nativeint

Pointer (handle) to the unmanaged object.

keyPath
NSString

Key-path to use to perform the value lookup. The keypath consists of a series of lowercase ASCII-strings with no spaces in them separated by dot characters.

Remarks

This constructor is invoked by the runtime infrastructure (GetNSObject(IntPtr)) to create a new managed representation for a pointer to an unmanaged Objective-C object. You should not invoke this method directly, instead you should call the GetNSObject method as it will prevent two instances of a managed object to point to the same native object.

Applies to

SetValueForKeyPath(NSObject, NSString)

Sets the value of a property that can be reached using a keypath.

[Foundation.Export("setValue:forKeyPath:")]
public virtual void SetValueForKeyPath (Foundation.NSObject value, Foundation.NSString keyPath);
abstract member SetValueForKeyPath : Foundation.NSObject * Foundation.NSString -> unit
override this.SetValueForKeyPath : Foundation.NSObject * Foundation.NSString -> unit

Parameters

value
NSObject

Value to set on the property.

keyPath
NSString

Key-path to use to perform the value lookup. The keypath consists of a series of lowercase ASCII-strings with no spaces in them separated by dot characters.

Attributes

Remarks

The keypath is separated by dots, and each component is used to lookup a specific key on the object. The process is repeated on each returning object until the last element is processed.

If a component of the key path is not found, the method SetValueForUndefinedKey(NSObject, NSString) is invoked, and its default implementation raises an Objective-C exception. Subclasses can alter this behavior by overriding that method.

string SetMobilePhone (Order order, NSString phone)
{
	return order.SetValueForKeyPath ("user.address.phone.mobile", phone);
}

Applies to