Table of Contents

Class NSView

Namespace
CarinaStudio.MacOS.AppKit
Assembly
CarinaStudio.AppBase.MacOS.dll

NSView.

public class NSView : NSResponder, IDisposable, IEquatable<NSObject>
Inheritance
NSView
Implements
Derived
Inherited Members
Extension Methods

Constructors

NSView(NSRect)

Initialize new NSView instance.

public NSView(NSRect frame)

Parameters

frame NSRect

Frame.

NSView(Class, IntPtr, bool)

Initialize new NSView instance.

protected NSView(Class cls, IntPtr handle, bool ownsInstance)

Parameters

cls Class

Class of instance.

handle nint

Handle of instance.

ownsInstance bool

True to own the instance.

NSView(IntPtr, NSRect)

Initialize new NSView instance.

protected NSView(IntPtr handle, NSRect frame)

Parameters

handle nint

Handle of allocated instance.

frame NSRect

Frame.

NSView(IntPtr, bool, bool)

Initialize new NSView instance.

protected NSView(IntPtr handle, bool verifyClass, bool ownsInstance)

Parameters

handle nint

Handle of instance.

verifyClass bool

True to verify whether instance is NSView or not.

ownsInstance bool

True to own the instance.

Properties

Appearance

Get or set appearance of view.

public NSAppearance? Appearance { get; set; }

Property Value

NSAppearance

BottomAnchor

Get layout anchor representing the bottom edge of the view’s frame.

public NSLayoutYAxisAnchor BottomAnchor { get; }

Property Value

NSLayoutYAxisAnchor

Bounds

Get or set bounds rectangle of view.

public NSRect Bounds { get; set; }

Property Value

NSRect

BoundsRotation

Get or set rotation of bounds in degrees.

public double BoundsRotation { get; set; }

Property Value

double

CenterXAnchor

Get layout anchor representing the horizontal center of the view’s frame.

public NSLayoutXAxisAnchor CenterXAnchor { get; }

Property Value

NSLayoutXAxisAnchor

CenterYAnchor

Get layout anchor representing the vertical center of the view’s frame.

public NSLayoutYAxisAnchor CenterYAnchor { get; }

Property Value

NSLayoutYAxisAnchor

Constraints

Get constraints held by the view.

public NSArray<NSLayoutConstraint> Constraints { get; }

Property Value

NSArray<NSLayoutConstraint>

FirstBaselineAnchor

Get layout anchor representing the baseline for the topmost line of text in the view.

public NSLayoutYAxisAnchor FirstBaselineAnchor { get; }

Property Value

NSLayoutYAxisAnchor

FittingSize

Get the minimum size of the view that satisfies the constraints it holds.

public NSSize FittingSize { get; }

Property Value

NSSize

Frame

Get or set frame of view in its superview’s coordinate system.

public NSRect Frame { get; set; }

Property Value

NSRect

FrameRotation

Get or set rotation of frame in degrees.

public double FrameRotation { get; set; }

Property Value

double

HeightAnchor

Get layout anchor representing the height of the view’s frame.

public NSLayoutDimension HeightAnchor { get; }

Property Value

NSLayoutDimension

IntrinsicContentSize

Get natural size of view.

public NSSize IntrinsicContentSize { get; }

Property Value

NSSize

IsFlipped

Check whether the view uses a flipped coordinate system.

public bool IsFlipped { get; }

Property Value

bool

IsHidden

Get or set whether view is hidden or not.

public bool IsHidden { get; set; }

Property Value

bool

IsHiddenOrHasHiddenAncestor

Check whether view or its ancestor is hidden or not.

public bool IsHiddenOrHasHiddenAncestor { get; }

Property Value

bool

LastBaselineAnchor

Get layout anchor representing the baseline for the bottommost line of text in the view.

public NSLayoutYAxisAnchor LastBaselineAnchor { get; }

Property Value

NSLayoutYAxisAnchor

LeadingAnchor

Get layout anchor representing the leading edge of the view’s frame.

public NSLayoutXAxisAnchor LeadingAnchor { get; }

Property Value

NSLayoutXAxisAnchor

LeftAnchor

Get layout anchor representing the left edge of the view’s frame.

public NSLayoutXAxisAnchor LeftAnchor { get; }

Property Value

NSLayoutXAxisAnchor

NeedsLayout

Get or set whether the view needs a layout pass before it can be drawn.

public bool NeedsLayout { get; set; }

Property Value

bool

RightAnchor

Get layout anchor representing the right edge of the view’s frame.

public NSLayoutXAxisAnchor RightAnchor { get; }

Property Value

NSLayoutXAxisAnchor

SafeAreaInsets

Get distances from the edges of your view that define the safe area.

public NSEdgeInsets SafeAreaInsets { get; }

Property Value

NSEdgeInsets

SafeAreaRect

A rectangle in the view’s coordinate system that contains the unobscured portion of the view.

public NSRect SafeAreaRect { get; }

Property Value

NSRect

SubViews

Get all child views.

public NSArray<NSView> SubViews { get; }

Property Value

NSArray<NSView>

SuperView

Get parent view.

public NSView? SuperView { get; }

Property Value

NSView

Tag

Get tag of view.

public int Tag { get; }

Property Value

int

TopAnchor

Get layout anchor representing the top edge of the view’s frame.

public NSLayoutYAxisAnchor TopAnchor { get; }

Property Value

NSLayoutYAxisAnchor

TrailingAnchor

Get layout anchor representing the trailing edge of the view’s frame.

public NSLayoutXAxisAnchor TrailingAnchor { get; }

Property Value

NSLayoutXAxisAnchor

TranslatesAutoresizingMaskIntoConstraints

Get or set whether the view’s autoresizing mask is translated into constraints for the constraint-based layout system.

public bool TranslatesAutoresizingMaskIntoConstraints { get; set; }

Property Value

bool

VisibleRect

Get bounds of view which is not clipped by its super view.

public NSRect VisibleRect { get; }

Property Value

NSRect

WidthAnchor

Get layout anchor representing the width of the view’s frame.

public NSLayoutDimension WidthAnchor { get; }

Property Value

NSLayoutDimension

Window

Get window which contains the view.

public NSWindow? Window { get; }

Property Value

NSWindow

Methods

AddConstraint(NSLayoutConstraint)

Add constraint on the layout of view.

public void AddConstraint(NSLayoutConstraint constraint)

Parameters

constraint NSLayoutConstraint

Constraint.

AddConstraints(params NSLayoutConstraint[])

Add multiple constraints on the layout of view.

public void AddConstraints(params NSLayoutConstraint[] constraints)

Parameters

constraints NSLayoutConstraint[]

Constraint.

AddConstraints(NSArray<NSLayoutConstraint>)

Add multiple constraints on the layout of view.

public void AddConstraints(NSArray<NSLayoutConstraint> constraints)

Parameters

constraints NSArray<NSLayoutConstraint>

Constraint.

AddSubView(NSView)

Add given view as sub-view.

public void AddSubView(NSView view)

Parameters

view NSView

View.

AddSubView(NSView, OrderingMode, NSView?)

Add given view as sub-view.

public void AddSubView(NSView view, NSWindow.OrderingMode place, NSView? otherView)

Parameters

view NSView

View.

place NSWindow.OrderingMode

Relation to other view.

otherView NSView

Other view which the sub-view relative to.

Initialize(IntPtr, NSRect)

Initialize NSView with frame.

protected static IntPtr Initialize(IntPtr view, NSRect frame)

Parameters

view nint

Handle of allocated NSView.

frame NSRect

Frame.

Returns

nint

Handle of initialized NSView.

InvalidateIntrinsicContentSize()

Invalidate the view’s intrinsic content size.

public void InvalidateIntrinsicContentSize()

Layout()

Perform layout.

public void Layout()

RemoveConstraint(NSLayoutConstraint)

Add constraint from view.

public void RemoveConstraint(NSLayoutConstraint constraint)

Parameters

constraint NSLayoutConstraint

Constraint.

RemoveConstraints(params NSLayoutConstraint[])

Add multiple constraints from view.

public void RemoveConstraints(params NSLayoutConstraint[] constraints)

Parameters

constraints NSLayoutConstraint[]

Constraint.

RemoveConstraints(NSArray<NSLayoutConstraint>)

Add multiple constraints from view.

public void RemoveConstraints(NSArray<NSLayoutConstraint> constraints)

Parameters

constraints NSArray<NSLayoutConstraint>

Constraint.

RemoveFromSuperView()

Remove from its super view.

public void RemoveFromSuperView()

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.