<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSBrowserDelegate",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSBrowserDelegate"
  },
  "title" : "NSBrowserDelegate"
}
-->

# NSBrowserDelegate

A set of methods that a browser delegate implements to manage selection, scrolling, sizing, and other behavior.

```
protocol NSBrowserDelegate : NSObjectProtocol
```

## Topics

### Getting Browser Information

[`-  browser:isColumnValid:`](/documentation/AppKit/NSBrowserDelegate/browser(_:isColumnValid:))

Returns whether the contents of the specified column are valid.

[`-  browser:numberOfRowsInColumn:`](/documentation/AppKit/NSBrowserDelegate/browser(_:numberOfRowsInColumn:))

Returns the number of rows of data in the specified column.

[`-  browser:numberOfChildrenOfItem:`](/documentation/AppKit/NSBrowserDelegate/browser(_:numberOfChildrenOfItem:))

Asks the delegate for the number of children the given item has.

[`-  browser:titleOfColumn:`](/documentation/AppKit/NSBrowserDelegate/browser(_:titleOfColumn:))

Asks the delegate for the title to display above the specified column.

### Managing Selection Behavior

[`-  browser:shouldTypeSelectForEvent:withCurrentSearchString:`](/documentation/AppKit/NSBrowserDelegate/browser(_:shouldTypeSelectFor:withCurrentSearch:))

Sent to the delegate to determine whether keyboard-based selection (type select) for a given event and search string should proceed.

[`-  browser:typeSelectStringForRow:inColumn:`](/documentation/AppKit/NSBrowserDelegate/browser(_:typeSelectStringForRow:inColumn:))

Sent to the delegate to get the keyboard-based selection (type select) string for the specified row and column.

[`-  browser:nextTypeSelectMatchFromRow:toRow:inColumn:forString:`](/documentation/AppKit/NSBrowserDelegate/browser(_:nextTypeSelectMatchFromRow:toRow:inColumn:for:))

Sent to the delegate to customize a browser’s keyboard-based selection (type select) behavior.

### Managing Selection

[`-  browser:selectCellWithString:inColumn:`](/documentation/AppKit/NSBrowserDelegate/browser(_:selectCellWith:inColumn:))

Asks the delegate to select the cell with the given title in the specified column.

[`-  browser:selectRow:inColumn:`](/documentation/AppKit/NSBrowserDelegate/browser(_:selectRow:inColumn:))

Asks the delegate to select the cell at the specified row and column location.

[`-  browser:selectionIndexesForProposedSelection:inColumn:`](/documentation/AppKit/NSBrowserDelegate/browser(_:selectionIndexesForProposedSelection:inColumn:))

Asks the delegate for a set of indexes to select when the user changes the selection in the browser with the keyboard or mouse.

### Accessing Components

[`-  browser:child:ofItem:`](/documentation/AppKit/NSBrowserDelegate/browser(_:child:ofItem:))

Asks the delegate to return the child of the specified item at the specified index.

[`-  browser:isLeafItem:`](/documentation/AppKit/NSBrowserDelegate/browser(_:isLeafItem:))

Asks the delegate whether the specified item is a leaf item (an item that cannot be expanded).

[`-  browser:shouldEditItem:`](/documentation/AppKit/NSBrowserDelegate/browser(_:shouldEditItem:))

Asks the delegate whether the browser may start an editing session for the specified item.

[`-  browser:objectValueForItem:`](/documentation/AppKit/NSBrowserDelegate/browser(_:objectValueForItem:))

Returns the object that the specified item uses to draw its contents.

[`-  browser:setObjectValue:forItem:`](/documentation/AppKit/NSBrowserDelegate/browser(_:setObjectValue:forItem:))

Sets the object that the specified item uses to draw its contents to the specified object.

[`-  rootItemForBrowser:`](/documentation/AppKit/NSBrowserDelegate/rootItem(for:))

Asks the delegate to return the root item of the browser.

[`-  browser:previewViewControllerForLeafItem:`](/documentation/AppKit/NSBrowserDelegate/browser(_:previewViewControllerForLeafItem:))

Asks the delegate for a controller that provides a preview column for the specified leaf item.

[`-  browser:headerViewControllerForItem:`](/documentation/AppKit/NSBrowserDelegate/browser(_:headerViewControllerForItem:))

Asks the delegate for a controller that provides a header view for the specified column item.

### Managing Columns

[`-  browser:createRowsForColumn:inMatrix:`](/documentation/AppKit/NSBrowserDelegate/browser(_:createRowsForColumn:in:))

Creates a row in the given matrix for each row of data in the specified column of the browser.

[`-  browser:willDisplayCell:atRow:column:`](/documentation/AppKit/NSBrowserDelegate/browser(_:willDisplayCell:atRow:column:))

Gives the delegate the opportunity to modify the specified cell at the given row and column location before the browser displays it.

[`-  browser:didChangeLastColumn:toColumn:`](/documentation/AppKit/NSBrowserDelegate/browser(_:didChangeLastColumn:toColumn:))

Tells the delegate that the browser’s last column changed.

### Scrolling

[`-  browserWillScroll:`](/documentation/AppKit/NSBrowserDelegate/browserWillScroll(_:))

Notifies the delegate when the browser will scroll.

[`-  browserDidScroll:`](/documentation/AppKit/NSBrowserDelegate/browserDidScroll(_:))

Notifies the delegate when the browser has scrolled.

### Dragging

[`-  browser:canDragRowsWithIndexes:inColumn:withEvent:`](/documentation/AppKit/NSBrowserDelegate/browser(_:canDragRowsWith:inColumn:with:))

Sent to the delegate to determine whether the browser can attempt to initiate a drag of the specified rows for the specified event.

[`-  browser:draggingImageForRowsWithIndexes:inColumn:withEvent:offset:`](/documentation/AppKit/NSBrowserDelegate/browser(_:draggingImageForRowsWith:inColumn:with:offset:))

Sent to the delegate to obtain an image to represent dragged rows during a drag operation on a browser.

[`-  browser:validateDrop:proposedRow:column:dropOperation:`](/documentation/AppKit/NSBrowserDelegate/browser(_:validateDrop:proposedRow:column:dropOperation:))

Sent to the delegate during a dragging session to determine whether a drop should be accepted and to obtain the drop location. This method is required for a browser to be a drag destination.

[`-  browser:acceptDrop:atRow:column:dropOperation:`](/documentation/AppKit/NSBrowserDelegate/browser(_:acceptDrop:atRow:column:dropOperation:))

Sent to the delegate during a dragging session to determine whether to accept the drop.

[`-  browser:writeRowsWithIndexes:inColumn:toPasteboard:`](/documentation/AppKit/NSBrowserDelegate/browser(_:writeRowsWith:inColumn:to:))

Determines whether a drag operation can proceed. This method is required for a browser to be a drag source.

[`-  browser:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:inColumn:`](/documentation/AppKit/NSBrowserDelegate/browser(_:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWith:inColumn:))

Implements file promise drag operations.

### Sizing

[`-  browser:shouldSizeColumn:forUserResize:toWidth:`](/documentation/AppKit/NSBrowserDelegate/browser(_:shouldSizeColumn:forUserResize:toWidth:))

Used to determine a column’s initial size.

[`-  browser:sizeToFitWidthOfColumn:`](/documentation/AppKit/NSBrowserDelegate/browser(_:sizeToFitWidthOfColumn:))

Returns the ideal width for a column.

[`-  browserColumnConfigurationDidChange:`](/documentation/AppKit/NSBrowserDelegate/browserColumnConfigurationDidChange(_:))

Used by clients to implement their own column width persistence.

[`-  browser:heightOfRow:inColumn:`](/documentation/AppKit/NSBrowserDelegate/browser(_:heightOfRow:inColumn:))

Specifies the height of the specified row in the specified column.

### Displaying Cell Content

[`-  browser:shouldShowCellExpansionForRow:column:`](/documentation/AppKit/NSBrowserDelegate/browser(_:shouldShowCellExpansionForRow:column:))

Invoked to allow the delegate to control cell expansion for a specific row and column.

## Relationships

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)