One Logo Pool Ball
UIKit · IOS API REFERENCE

UIButton

class · iOS 2.0+ · SDK 27.1

@MainActor class UIButton

Members (75)

init · iOS 2.0+

init

TypeScript
static initType(buttonType: UIButton_ButtonType): Promise<UIButton>
Swift declaration
convenience init(type buttonType: UIButton.ButtonType)
method · iOS 6.0+

attributedTitle

TypeScript
attributedTitle(state: UIControl_State): Promise<(_Foundation_NSAttributedString) | null>
Swift declaration
func attributedTitle(for state: UIControl.State) -> NSAttributedString?
method · iOS 2.0+

backgroundImage

TypeScript
backgroundImage(state: UIControl_State): Promise<(UIImage) | null>
Swift declaration
func backgroundImage(for state: UIControl.State) -> UIImage?
method · iOS 2.0+ · Deprecated in iOS 15.0

backgroundRect

TypeScript
backgroundRect(bounds: { x: number; y: number; width: number; height: number }): Promise<{ x: number; y: number; width: number; height: number }>
Swift declaration
func backgroundRect(forBounds bounds: CGRect) -> CGRect
method · iOS 2.0+ · Deprecated in iOS 15.0

contentRect

TypeScript
contentRect(bounds: { x: number; y: number; width: number; height: number }): Promise<{ x: number; y: number; width: number; height: number }>
Swift declaration
func contentRect(forBounds bounds: CGRect) -> CGRect
method · iOS 2.0+

image

TypeScript
image(state: UIControl_State): Promise<(UIImage) | null>
Swift declaration
func image(for state: UIControl.State) -> UIImage?
method · iOS 2.0+ · Deprecated in iOS 15.0

imageRect

TypeScript
imageRect(contentRect: { x: number; y: number; width: number; height: number }): Promise<{ x: number; y: number; width: number; height: number }>
Swift declaration
func imageRect(forContentRect contentRect: CGRect) -> CGRect
init · iOS 2.0+

init

TypeScript
static initCoder(coder: _Foundation_NSCoder): Promise<(UIButton) | null>
Swift declaration
init?(coder: NSCoder)
init · iOS 2.0+

init

TypeScript
static initFrame(frame: { x: number; y: number; width: number; height: number }): Promise<UIButton>
Swift declaration
init(frame: CGRect)
init · iOS 14.0+

init

TypeScript
static initFramePrimaryAction(frame: { x: number; y: number; width: number; height: number }, primaryAction?: (UIAction) | null): Promise<UIButton>
Swift declaration
convenience init(frame: CGRect, primaryAction: UIAction?)
method · iOS 13.0+

preferredSymbolConfigurationForImage

TypeScript
preferredSymbolConfigurationForImage(state: UIControl_State): Promise<(UIImage_SymbolConfiguration) | null>
Swift declaration
func preferredSymbolConfigurationForImage(in state: UIControl.State) -> UIImage.SymbolConfiguration?
method · iOS 6.0+

setAttributedTitle

TypeScript
setAttributedTitle(title: (_Foundation_NSAttributedString) | null, state: UIControl_State): Promise<void>
Swift declaration
func setAttributedTitle(_ title: NSAttributedString?, for state: UIControl.State)
method · iOS 2.0+

setBackgroundImage

TypeScript
setBackgroundImage(image: (UIImage) | null, state: UIControl_State): Promise<void>
Swift declaration
func setBackgroundImage(_ image: UIImage?, for state: UIControl.State)
method · iOS 2.0+

setImage

TypeScript
setImage(image: (UIImage) | null, state: UIControl_State): Promise<void>
Swift declaration
func setImage(_ image: UIImage?, for state: UIControl.State)
method · iOS 15.0+

setNeedsUpdateConfiguration

TypeScript
setNeedsUpdateConfiguration(): Promise<void>
Swift declaration
func setNeedsUpdateConfiguration()
method · iOS 13.0+

setPreferredSymbolConfiguration

TypeScript
setPreferredSymbolConfiguration(configuration: (UIImage_SymbolConfiguration) | null, state: UIControl_State): Promise<void>
Swift declaration
func setPreferredSymbolConfiguration(_ configuration: UIImage.SymbolConfiguration?, forImageIn state: UIControl.State)
method · iOS 2.0+

setTitle

TypeScript
setTitle(title: (string) | null, state: UIControl_State): Promise<void>
Swift declaration
func setTitle(_ title: String?, for state: UIControl.State)
method · iOS 2.0+

setTitleColor

TypeScript
setTitleColor(color: (UIColor) | null, state: UIControl_State): Promise<void>
Swift declaration
func setTitleColor(_ color: UIColor?, for state: UIControl.State)
method · iOS 2.0+

setTitleShadowColor

TypeScript
setTitleShadowColor(color: (UIColor) | null, state: UIControl_State): Promise<void>
Swift declaration
func setTitleShadowColor(_ color: UIColor?, for state: UIControl.State)
method · iOS 2.0+

titleColor

TypeScript
titleColor(state: UIControl_State): Promise<(UIColor) | null>
Swift declaration
func titleColor(for state: UIControl.State) -> UIColor?
method · iOS 2.0+

title

TypeScript
title(state: UIControl_State): Promise<(string) | null>
Swift declaration
func title(for state: UIControl.State) -> String?
method · iOS 2.0+ · Deprecated in iOS 15.0

titleRect

TypeScript
titleRect(contentRect: { x: number; y: number; width: number; height: number }): Promise<{ x: number; y: number; width: number; height: number }>
Swift declaration
func titleRect(forContentRect contentRect: CGRect) -> CGRect
method · iOS 2.0+

titleShadowColor

TypeScript
titleShadowColor(state: UIControl_State): Promise<(UIColor) | null>
Swift declaration
func titleShadowColor(for state: UIControl.State) -> UIColor?
method · iOS 15.0+

updateConfiguration

TypeScript
updateConfiguration(): Promise<void>
Swift declaration
func updateConfiguration()
get · iOS 2.0+ · Deprecated in iOS 15.0

adjustsImageWhenDisabled

TypeScript
get adjustsImageWhenDisabled(): Promise<boolean>
Swift declaration
var adjustsImageWhenDisabled: Bool { get set }
set · iOS 2.0+ · Deprecated in iOS 15.0

adjustsImageWhenDisabled

TypeScript
setAdjustsImageWhenDisabled(value: boolean): Promise<void>
Swift declaration
var adjustsImageWhenDisabled: Bool { get set }
get · iOS 2.0+ · Deprecated in iOS 15.0

adjustsImageWhenHighlighted

TypeScript
get adjustsImageWhenHighlighted(): Promise<boolean>
Swift declaration
var adjustsImageWhenHighlighted: Bool { get set }
set · iOS 2.0+ · Deprecated in iOS 15.0

adjustsImageWhenHighlighted

TypeScript
setAdjustsImageWhenHighlighted(value: boolean): Promise<void>
Swift declaration
var adjustsImageWhenHighlighted: Bool { get set }
get · iOS 15.0+

automaticallyUpdatesConfiguration

TypeScript
get automaticallyUpdatesConfiguration(): Promise<boolean>
Swift declaration
var automaticallyUpdatesConfiguration: Bool { get set }
set · iOS 15.0+

automaticallyUpdatesConfiguration

TypeScript
setAutomaticallyUpdatesConfiguration(value: boolean): Promise<void>
Swift declaration
var automaticallyUpdatesConfiguration: Bool { get set }
get · iOS 15.0+

behavioralStyle

TypeScript
get behavioralStyle(): Promise<UIBehavioralStyle>
Swift declaration
var behavioralStyle: UIBehavioralStyle { get }
get · iOS 2.0+

buttonType

TypeScript
get buttonType(): Promise<UIButton_ButtonType>
Swift declaration
var buttonType: UIButton.ButtonType { get }
get · iOS 15.0+

changesSelectionAsPrimaryAction

TypeScript
get changesSelectionAsPrimaryAction(): Promise<boolean>
Swift declaration
var changesSelectionAsPrimaryAction: Bool { get set }
set · iOS 15.0+

changesSelectionAsPrimaryAction

TypeScript
setChangesSelectionAsPrimaryAction(value: boolean): Promise<void>
Swift declaration
var changesSelectionAsPrimaryAction: Bool { get set }
get · iOS 15.0+

configurationUpdateHandler

TypeScript
get configurationUpdateHandler(): Promise<(((arg0: UIButton) => Promise<void>)) | null>
Swift declaration
var configurationUpdateHandler: UIButton.ConfigurationUpdateHandler? { get set }
set · iOS 15.0+

configurationUpdateHandler

TypeScript
setConfigurationUpdateHandler(value?: (((arg0: UIButton) => void)) | null): Promise<void>
Swift declaration
var configurationUpdateHandler: UIButton.ConfigurationUpdateHandler? { get set }
get · iOS 2.0+ · Deprecated in iOS 15.0

contentEdgeInsets

TypeScript
get contentEdgeInsets(): Promise<{ top: number; left: number; bottom: number; right: number }>
Swift declaration
var contentEdgeInsets: UIEdgeInsets { get set }
set · iOS 2.0+ · Deprecated in iOS 15.0

contentEdgeInsets

TypeScript
setContentEdgeInsets(value: { top: number; left: number; bottom: number; right: number }): Promise<void>
Swift declaration
var contentEdgeInsets: UIEdgeInsets { get set }
get · iOS 6.0+

currentAttributedTitle

TypeScript
get currentAttributedTitle(): Promise<(_Foundation_NSAttributedString) | null>
Swift declaration
var currentAttributedTitle: NSAttributedString? { get }
get · iOS 2.0+

currentBackgroundImage

TypeScript
get currentBackgroundImage(): Promise<(UIImage) | null>
Swift declaration
var currentBackgroundImage: UIImage? { get }
get · iOS 2.0+

currentImage

TypeScript
get currentImage(): Promise<(UIImage) | null>
Swift declaration
var currentImage: UIImage? { get }
get · iOS 13.0+

currentPreferredSymbolConfiguration

TypeScript
get currentPreferredSymbolConfiguration(): Promise<(UIImage_SymbolConfiguration) | null>
Swift declaration
var currentPreferredSymbolConfiguration: UIImage.SymbolConfiguration? { get }
get · iOS 2.0+

currentTitle

TypeScript
get currentTitle(): Promise<(string) | null>
Swift declaration
var currentTitle: String? { get }
get · iOS 2.0+

currentTitleColor

TypeScript
get currentTitleColor(): Promise<UIColor>
Swift declaration
var currentTitleColor: UIColor { get }
get · iOS 2.0+

currentTitleShadowColor

TypeScript
get currentTitleShadowColor(): Promise<(UIColor) | null>
Swift declaration
var currentTitleShadowColor: UIColor? { get }
get · iOS 15.0+

isHeld

TypeScript
get isHeld(): Promise<boolean>
Swift declaration
var isHeld: Bool { get }
get · iOS 15.0+

isHovered

TypeScript
get isHovered(): Promise<boolean>
Swift declaration
var isHovered: Bool { get }
get · iOS 2.0+ · Deprecated in iOS 15.0

imageEdgeInsets

TypeScript
get imageEdgeInsets(): Promise<{ top: number; left: number; bottom: number; right: number }>
Swift declaration
var imageEdgeInsets: UIEdgeInsets { get set }
set · iOS 2.0+ · Deprecated in iOS 15.0

imageEdgeInsets

TypeScript
setImageEdgeInsets(value: { top: number; left: number; bottom: number; right: number }): Promise<void>
Swift declaration
var imageEdgeInsets: UIEdgeInsets { get set }
get · iOS 3.0+

imageView

TypeScript
get imageView(): Promise<(UIImageView) | null>
Swift declaration
var imageView: UIImageView? { get }
get · iOS 14.0+

menu

TypeScript
get menu(): Promise<(UIMenu) | null>
Swift declaration
@NSCopying var menu: UIMenu? { get set }
set · iOS 14.0+

menu

TypeScript
setMenu(value?: (UIMenu) | null): Promise<void>
Swift declaration
@NSCopying var menu: UIMenu? { get set }
get · iOS 13.4+

isPointerInteractionEnabled

TypeScript
get isPointerInteractionEnabled(): Promise<boolean>
Swift declaration
var isPointerInteractionEnabled: Bool { get set }
set · iOS 13.4+

isPointerInteractionEnabled

TypeScript
setIsPointerInteractionEnabled(value: boolean): Promise<void>
Swift declaration
var isPointerInteractionEnabled: Bool { get set }
get · iOS 15.0+

preferredBehavioralStyle

TypeScript
get preferredBehavioralStyle(): Promise<UIBehavioralStyle>
Swift declaration
var preferredBehavioralStyle: UIBehavioralStyle { get set }
set · iOS 15.0+

preferredBehavioralStyle

TypeScript
setPreferredBehavioralStyle(value: UIBehavioralStyle): Promise<void>
Swift declaration
var preferredBehavioralStyle: UIBehavioralStyle { get set }
get · iOS 16.0+

preferredMenuElementOrder

TypeScript
get preferredMenuElementOrder(): Promise<UIContextMenuConfiguration_ElementOrder>
Swift declaration
var preferredMenuElementOrder: UIContextMenuConfiguration.ElementOrder { get set }
set · iOS 16.0+

preferredMenuElementOrder

TypeScript
setPreferredMenuElementOrder(value: UIContextMenuConfiguration_ElementOrder): Promise<void>
Swift declaration
var preferredMenuElementOrder: UIContextMenuConfiguration.ElementOrder { get set }
get · iOS 2.0+ · Deprecated in iOS 15.0

reversesTitleShadowWhenHighlighted

TypeScript
get reversesTitleShadowWhenHighlighted(): Promise<boolean>
Swift declaration
var reversesTitleShadowWhenHighlighted: Bool { get set }
set · iOS 2.0+ · Deprecated in iOS 15.0

reversesTitleShadowWhenHighlighted

TypeScript
setReversesTitleShadowWhenHighlighted(value: boolean): Promise<void>
Swift declaration
var reversesTitleShadowWhenHighlighted: Bool { get set }
get · iOS 14.0+

role

TypeScript
get role(): Promise<UIButton_Role>
Swift declaration
var role: UIButton.Role { get set }
set · iOS 14.0+

role

TypeScript
setRole(value: UIButton_Role): Promise<void>
Swift declaration
var role: UIButton.Role { get set }
get · iOS 2.0+ · Deprecated in iOS 15.0

showsTouchWhenHighlighted

TypeScript
get showsTouchWhenHighlighted(): Promise<boolean>
Swift declaration
var showsTouchWhenHighlighted: Bool { get set }
set · iOS 2.0+ · Deprecated in iOS 15.0

showsTouchWhenHighlighted

TypeScript
setShowsTouchWhenHighlighted(value: boolean): Promise<void>
Swift declaration
var showsTouchWhenHighlighted: Bool { get set }
get · iOS 15.0+

subtitleLabel

TypeScript
get subtitleLabel(): Promise<(UILabel) | null>
Swift declaration
var subtitleLabel: UILabel? { get }
get · iOS 5.0+

tintColor

TypeScript
get tintColor(): Promise<(UIColor) | null>
Swift declaration
var tintColor: UIColor! { get set }
set · iOS 5.0+

tintColor

TypeScript
setTintColor(value?: (UIColor) | null): Promise<void>
Swift declaration
var tintColor: UIColor! { get set }
get · iOS 2.0+ · Deprecated in iOS 15.0

titleEdgeInsets

TypeScript
get titleEdgeInsets(): Promise<{ top: number; left: number; bottom: number; right: number }>
Swift declaration
var titleEdgeInsets: UIEdgeInsets { get set }
set · iOS 2.0+ · Deprecated in iOS 15.0

titleEdgeInsets

TypeScript
setTitleEdgeInsets(value: { top: number; left: number; bottom: number; right: number }): Promise<void>
Swift declaration
var titleEdgeInsets: UIEdgeInsets { get set }
get · iOS 3.0+

titleLabel

TypeScript
get titleLabel(): Promise<(UILabel) | null>
Swift declaration
var titleLabel: UILabel? { get }
init · iOS 15.0+

init

TypeScript
static initConfigurationPrimaryAction(configuration: UIButton_Configuration, primaryAction?: (UIAction) | null): Promise<UIButton>
Swift declaration
@MainActor @preconcurrency convenience init(configuration: UIButton.Configuration, primaryAction: UIAction? = nil)
get · iOS 15.0+

configuration

TypeScript
get configuration(): Promise<(UIButton_Configuration) | null>
Swift declaration
@MainActor @preconcurrency var configuration: UIButton.Configuration? { get set }
set · iOS 15.0+

configuration

TypeScript
setConfiguration(value?: (UIButton_Configuration) | null): Promise<void>
Swift declaration
@MainActor @preconcurrency var configuration: UIButton.Configuration? { get set }
get · iOS 13.4+

pointerStyleProvider

TypeScript
get pointerStyleProvider(): Promise<(((arg0: UIButton, arg1: UIPointerEffect, arg2: UIPointerShape) => Promise<(UIPointerStyle) | null>)) | null>
Swift declaration
@MainActor @preconcurrency var pointerStyleProvider: UIButton.PointerStyleProvider? { get set }
init · iOS 14.0+

init

TypeScript
static initTypePrimaryAction(buttonType?: UIButton_ButtonType, primaryAction?: (UIAction) | null): Promise<UIButton>
Swift declaration
@MainActor @preconcurrency convenience init(type buttonType: UIButton.ButtonType = .system, primaryAction: UIAction?)

Skipped declarations

3 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

UIButton.pointerStyleProvider

closure property answers its caller

UIButton.systemButton(with:target:action:)

Objective-C selectors cannot cross the bridge.

UIButton.init()

inherited init: cannot prove legal (class declares 5 custom initializers)

All UIKit types →