<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.10.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSForm",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSForm"
  },
  "title" : "NSForm"
}
-->

# NSForm

An `NSForm` object is a vertical matrix of [`NSFormCell`](/documentation/AppKit/NSFormCell) objects to implement the fields.

```
class NSForm
```

## Topics

### Adding and Removing Entries

[`addEntry(_:)`](/documentation/AppKit/NSForm/addEntry(_:))

Adds a new entry to the end of the receiver and gives it the specified title.

[`insertEntry(_:at:)`](/documentation/AppKit/NSForm/insertEntry(_:at:))

Inserts an entry with the specified title into the receiver.

[`removeEntry(at:)`](/documentation/AppKit/NSForm/removeEntry(at:))

Removes and releases the entry at the specified index.

### Changing the Appearance of All the Entries

[`setBezeled(_:)`](/documentation/AppKit/NSForm/setBezeled(_:))

Sets whether the receiver’s entries should display a bezel around their editable text.

[`setBordered(_:)`](/documentation/AppKit/NSForm/setBordered(_:))

Sets whether the receiver’s entries should display a border around their editable text fields.

[`setEntryWidth(_:)`](/documentation/AppKit/NSForm/setEntryWidth(_:))

Sets the width of all the entries in the receiver.

[`setFrameSize(_:)`](/documentation/AppKit/NSForm/setFrameSize(_:))

Sets the size of the receiver’s frame size to the specified value.

[`setInterlineSpacing(_:)`](/documentation/AppKit/NSForm/setInterlineSpacing(_:))

Sets the spacing between entries

[`setTitleAlignment(_:)`](/documentation/AppKit/NSForm/setTitleAlignment(_:))

Sets the alignment for all of the entry titles.

[`setTitleBaseWritingDirection(_:)`](/documentation/AppKit/NSForm/setTitleBaseWritingDirection(_:))

Sets the writing direction for the title of every control embedded in the form.

[`setTextAlignment(_:)`](/documentation/AppKit/NSForm/setTextAlignment(_:))

Sets the alignment for all of the receiver’s editable text.

[`setTextBaseWritingDirection(_:)`](/documentation/AppKit/NSForm/setTextBaseWritingDirection(_:))

Sets the writing direction for the text content of every control embedded in the form.

[`setTitleFont(_:)`](/documentation/AppKit/NSForm/setTitleFont(_:))

Sets the font for all of the entry titles.

[`setTextFont(_:)`](/documentation/AppKit/NSForm/setTextFont(_:))

Sets the font for all of the receiver’s editable text fields

### Getting Cells and Indices

[`indexOfCell(withTag:)`](/documentation/AppKit/NSForm/indexOfCell(withTag:))

Returns the index of the entry whose tag is `tag`.

[`indexOfSelectedItem()`](/documentation/AppKit/NSForm/indexOfSelectedItem())

Returns the index of the selected entry.

[`cell(at:)`](/documentation/AppKit/NSForm/cell(at:))

Returns the entry at the specified index.

### Displaying a Cell

[`drawCell(at:)`](/documentation/AppKit/NSForm/drawCell(at:))

Displays the entry at the specified index.

### Auto Layout Sizing

[`preferredTextFieldWidth()`](/documentation/AppKit/NSForm/preferredTextFieldWidth())

The preferred width of the form’s cells when using Auto Layout.

[`setPreferredTextFieldWidth(_:)`](/documentation/AppKit/NSForm/setPreferredTextFieldWidth(_:))

Sets the preferred text field width used by Auto Layout.

### Editing Text

[`selectText(at:)`](/documentation/AppKit/NSForm/selectText(at:))

Selects the entry at the specified index.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)