RegisterAttribute Class

Definition

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

[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class RegisterAttribute : Attribute
type RegisterAttribute = class
    inherit Attribute
Inheritance
RegisterAttribute
Attributes

Remarks

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.
[Register]
public class MyView : UIView {
    public MyView (IntPtr handle) : base (handle) {}
    public MyView (CGRect rect) : base (rect) {}
}

Constructors

RegisterAttribute()
RegisterAttribute(String)

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

RegisterAttribute(String, Boolean)

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

Properties

IsWrapper

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

Name

The name used to expose the class.

SkipRegistration

Applies to