<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIButton/init(type:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIButton(cm)buttonWithType:"
  },
  "title" : "init(type:)"
}
-->

# init(type:)

Creates and returns a new button of the specified type.

```
convenience init(type buttonType: UIButton.ButtonType)
```

## Parameters

`buttonType`

The button type. See [`UIButton.ButtonType`](/documentation/UIKit/UIButton/ButtonType-swift.enum) for the possible values.

## Return Value

A newly created button.

## Discussion

This method is a convenience constructor for creating button objects with specific configurations.

When creating a custom button — a button with the type [`UIButton.ButtonType.custom`](/documentation/UIKit/UIButton/ButtonType-swift.enum/custom) — the frame of the button is set to (`0`, `0`, `0`, `0`) initially. Before adding the button to your interface, you should update the frame to a more appropriate value.

## See Also

[UIKit Catalog: Creating and customizing views and controls](/documentation/UIKit/uikit-catalog-creating-and-customizing-views-and-controls)

Customize your app’s user interface with views and controls.



---

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)