One Logo Pool Ball
UIKit · IOS API REFERENCE

UISegmentedControl

class · iOS 2.0+ · SDK 27.1

@MainActor class UISegmentedControl

Members (40)

get

noSegment

TypeScript
static get noSegment(): Promise<number>
Swift declaration
class var noSegment: Int { get }
method · iOS 14.0+

actionForSegment

TypeScript
actionForSegment(segment: number): Promise<(UIAction) | null>
Swift declaration
func actionForSegment(at segment: Int) -> UIAction?
method · iOS 5.0+

backgroundImage

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

contentOffsetForSegment

TypeScript
contentOffsetForSegment(segment: number): Promise<{ width: number; height: number }>
Swift declaration
func contentOffsetForSegment(at segment: Int) -> CGSize
method · iOS 5.0+

contentPositionAdjustment

TypeScript
contentPositionAdjustment(leftCenterRightOrAlone: UISegmentedControl_Segment, barMetrics: UIBarMetrics): Promise<UIOffset>
Swift declaration
func contentPositionAdjustment(forSegmentType leftCenterRightOrAlone: UISegmentedControl.Segment, barMetrics: UIBarMetrics) -> UIOffset
method · iOS 5.0+

dividerImage

TypeScript
dividerImage(leftState: UIControl_State, rightState: UIControl_State, barMetrics: UIBarMetrics): Promise<(UIImage) | null>
Swift declaration
func dividerImage(forLeftSegmentState leftState: UIControl.State, rightSegmentState rightState: UIControl.State, barMetrics: UIBarMetrics) -> UIImage?
method · iOS 2.0+

imageForSegment

TypeScript
imageForSegment(segment: number): Promise<(UIImage) | null>
Swift declaration
func imageForSegment(at segment: Int) -> UIImage?
init · iOS 2.0+

init

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

init

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

init

TypeScript
static initFrameActions(frame: { x: number; y: number; width: number; height: number }, actions: Array<UIAction>): Promise<UISegmentedControl>
Swift declaration
convenience init(frame: CGRect, actions: [UIAction])
init · iOS 2.0+

init

TypeScript
static initItems(items?: (Array<unknown>) | null): Promise<UISegmentedControl>
Swift declaration
init(items: [Any]?)
method · iOS 14.0+

insertSegment

TypeScript
insertSegmentActionAtAnimated(action: UIAction, segment: number, animated: boolean): Promise<void>
Swift declaration
func insertSegment(action: UIAction, at segment: Int, animated: Bool)
method · iOS 2.0+

insertSegment

TypeScript
insertSegmentWithAtAnimated(image: (UIImage) | null, segment: number, animated: boolean): Promise<void>
Swift declaration
func insertSegment(with image: UIImage?, at segment: Int, animated: Bool)
method · iOS 2.0+

insertSegment

TypeScript
insertSegmentWithTitleAtAnimated(title: (string) | null, segment: number, animated: boolean): Promise<void>
Swift declaration
func insertSegment(withTitle title: String?, at segment: Int, animated: Bool)
method · iOS 2.0+

isEnabledForSegment

TypeScript
isEnabledForSegment(segment: number): Promise<boolean>
Swift declaration
func isEnabledForSegment(at segment: Int) -> Bool
method · iOS 2.0+

removeAllSegments

TypeScript
removeAllSegments(): Promise<void>
Swift declaration
func removeAllSegments()
method · iOS 2.0+

removeSegment

TypeScript
removeSegment(segment: number, animated: boolean): Promise<void>
Swift declaration
func removeSegment(at segment: Int, animated: Bool)
method · iOS 14.0+

segmentIndex

TypeScript
segmentIndex(actionIdentifier: UIAction_Identifier): Promise<number>
Swift declaration
func segmentIndex(identifiedBy actionIdentifier: UIAction.Identifier) -> Int
method · iOS 14.0+

setAction

TypeScript
setAction(action: UIAction, segment: number): Promise<void>
Swift declaration
func setAction(_ action: UIAction, forSegmentAt segment: Int)
method · iOS 5.0+

setBackgroundImage

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

setContentOffset

TypeScript
setContentOffset(offset: { width: number; height: number }, segment: number): Promise<void>
Swift declaration
func setContentOffset(_ offset: CGSize, forSegmentAt segment: Int)
method · iOS 5.0+

setContentPositionAdjustment

TypeScript
setContentPositionAdjustment(adjustment: UIOffset, leftCenterRightOrAlone: UISegmentedControl_Segment, barMetrics: UIBarMetrics): Promise<void>
Swift declaration
func setContentPositionAdjustment(_ adjustment: UIOffset, forSegmentType leftCenterRightOrAlone: UISegmentedControl.Segment, barMetrics: UIBarMetrics)
method · iOS 5.0+

setDividerImage

TypeScript
setDividerImage(dividerImage: (UIImage) | null, leftState: UIControl_State, rightState: UIControl_State, barMetrics: UIBarMetrics): Promise<void>
Swift declaration
func setDividerImage(_ dividerImage: UIImage?, forLeftSegmentState leftState: UIControl.State, rightSegmentState rightState: UIControl.State, barMetrics: UIBarMetrics)
method · iOS 2.0+

setEnabled

TypeScript
setEnabled(enabled: boolean, segment: number): Promise<void>
Swift declaration
func setEnabled(_ enabled: Bool, forSegmentAt segment: Int)
method · iOS 2.0+

setImage

TypeScript
setImage(image: (UIImage) | null, segment: number): Promise<void>
Swift declaration
func setImage(_ image: UIImage?, forSegmentAt segment: Int)
method · iOS 2.0+

setTitle

TypeScript
setTitle(title: (string) | null, segment: number): Promise<void>
Swift declaration
func setTitle(_ title: String?, forSegmentAt segment: Int)
method · iOS 5.0+

setTitleTextAttributes

TypeScript
setTitleTextAttributes(attributes: (NativeMap<_Foundation_NSAttributedString_Key, unknown>) | null, state: UIControl_State): Promise<void>
Swift declaration
func setTitleTextAttributes(_ attributes: [NSAttributedString.Key : Any]?, for state: UIControl.State)
method · iOS 2.0+

setWidth

TypeScript
setWidth(width: number, segment: number): Promise<void>
Swift declaration
func setWidth(_ width: CGFloat, forSegmentAt segment: Int)
method · iOS 2.0+

titleForSegment

TypeScript
titleForSegment(segment: number): Promise<(string) | null>
Swift declaration
func titleForSegment(at segment: Int) -> String?
method · iOS 5.0+

titleTextAttributes

TypeScript
titleTextAttributes(state: UIControl_State): Promise<(NativeMap<_Foundation_NSAttributedString_Key, unknown>) | null>
Swift declaration
func titleTextAttributes(for state: UIControl.State) -> [NSAttributedString.Key : Any]?
method · iOS 2.0+

widthForSegment

TypeScript
widthForSegment(segment: number): Promise<number>
Swift declaration
func widthForSegment(at segment: Int) -> CGFloat
get · iOS 5.0+

apportionsSegmentWidthsByContent

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

apportionsSegmentWidthsByContent

TypeScript
setApportionsSegmentWidthsByContent(value: boolean): Promise<void>
Swift declaration
var apportionsSegmentWidthsByContent: Bool { get set }
get · iOS 2.0+

isMomentary

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

isMomentary

TypeScript
setIsMomentary(value: boolean): Promise<void>
Swift declaration
var isMomentary: Bool { get set }
get · iOS 2.0+

numberOfSegments

TypeScript
get numberOfSegments(): Promise<number>
Swift declaration
var numberOfSegments: Int { get }
get · iOS 2.0+

selectedSegmentIndex

TypeScript
get selectedSegmentIndex(): Promise<number>
Swift declaration
var selectedSegmentIndex: Int { get set }
set · iOS 2.0+

selectedSegmentIndex

TypeScript
setSelectedSegmentIndex(value: number): Promise<void>
Swift declaration
var selectedSegmentIndex: Int { get set }
get · iOS 13.0+

selectedSegmentTintColor

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

selectedSegmentTintColor

TypeScript
setSelectedSegmentTintColor(value?: (UIColor) | null): Promise<void>
Swift declaration
var selectedSegmentTintColor: UIColor? { get set }

Skipped declarations

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

UISegmentedControl.init()

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

All UIKit types →