RegisterAttribute RegisterAttribute Class


Used to register a class to the Objective-C runtime.

public sealed class RegisterAttribute : Attribute
type RegisterAttribute = class
    inherit Attribute


While all classes derived from the NSObject class are exposed to the Objective-C world, in some cases you might want to expose the class using a different name to the runtime.

In addition, if you want your classes to be available on the iOS designer, you need to annotate those classes with the Register attribute.

// This class is never surfaced to Objective-C's runtime
class NotSurfaced {}

// This class is automatically surfaced to Objective-C's // runtime, since it is a subclass of NSObject, and it // is visible by the Objective-C runtime as "AutomaticallySurfaced" class AutomaticallySurfaced : NSObject {}

// This class is surfaced to the Objective-C runtime with // the name 'MyName' [Register ("MyName")] class InternalName : NSObject {}

// This UIView is surfaced to the iOS designer.
public class MyView : UIView {
    public MyView (IntPtr handle) : base (handle) {}
    public MyView (CGRect rect) : base (rect) {}


RegisterAttribute() RegisterAttribute()
RegisterAttribute(String) RegisterAttribute(String)

Used to specify how the ECMA class is exposed as an Objective-C class.

RegisterAttribute(String, Boolean) RegisterAttribute(String, Boolean)

Used to specify how the ECMA class is exposed as an Objective-C class.


IsWrapper IsWrapper

Specifies whether the class being registered is wrapping an existing Objective-C class, or if it's a new class.

Name Name

The name used to expose the class.

SkipRegistration SkipRegistration

Applies to