NSObject.BeginInvokeOnMainThread Method

Definition

Overloads

Name Description
BeginInvokeOnMainThread(Action)

Invokes the specified action asynchronously on the main UI thread.

BeginInvokeOnMainThread(Selector, NSObject)

Invokes asynchronously the specified code on the main UI thread.

BeginInvokeOnMainThread(Action)

Invokes the specified action asynchronously on the main UI thread.

public void BeginInvokeOnMainThread(Action action);
member this.BeginInvokeOnMainThread : Action -> unit

Parameters

action
Action

The action to invoke.

Remarks

This method queues the action to be executed when the main thread goes back to its main loop for processing events. The method returns immediately to the caller.

Applies to

BeginInvokeOnMainThread(Selector, NSObject)

Invokes asynchronously the specified code on the main UI thread.

public void BeginInvokeOnMainThread(ObjCRuntime.Selector sel, Foundation.NSObject obj);
public void BeginInvokeOnMainThread(ObjCRuntime.Selector sel, Foundation.NSObject? obj);
member this.BeginInvokeOnMainThread : ObjCRuntime.Selector * Foundation.NSObject -> unit

Parameters

sel
Selector

Selector to invoke

obj
NSObject

Object in which the selector is invoked

Remarks

You use this method from a thread to invoke the code in the specified object that is exposed with the specified selector in the UI thread. This is required for most operations that affect UIKit or AppKit as neither one of those APIs is thread safe.

The code is executed when the main thread goes back to its main loop for processing events.

Unlike InvokeOnMainThread(Selector, NSObject) this method merely queues the invocation and returns immediately to the caller.

Applies to