Skip to content

UIToolbar() constructor ​

The UIToolbar() constructor creates an empty toolbar.

Syntax ​

new UIToolbar()

Parameters ​

None.

Return value ​

A new UIToolbar. Its frame is 0 × 0 and items is an empty array. Its own preferred height is 48 pt; see Size.

Exceptions ​

TypeError

UIToolbar can't be subclassed; class X extends UIToolbar throws on new X(). See Native classes.

Examples ​

js
const toolbar = new UIToolbar();
console.log(toolbar.items.length);
console.log(toolbar.intrinsicContentSize.height);

Result: prints 0, then 48.

Corresponding iOS API ​

[[UIToolbar alloc] init].

See also ​

  • items: putting buttons on the toolbar