Class UISegmentedControl

All Implemented Interfaces:
CALayerDelegate, NSCoding, NSObjectProtocol, UIAccessibilityIdentification, UIActivityItemsConfigurationProviding, UIAppearanceContainer, UIContextMenuInteractionDelegate, UICoordinateSpace, UIDynamicItem, UIFocusEnvironment, UIFocusItem, UIFocusItemContainer, UILargeContentViewerItem, UIPasteConfigurationSupporting, UIResponderStandardEditActions, UISpringLoadedInteractionSupporting, UITraitEnvironment, UIUserActivityRestoring, ObjCProtocol

public class UISegmentedControl
extends UIControl
implements NSCoding, UISpringLoadedInteractionSupporting
  • Constructor Details

    • UISegmentedControl

      public UISegmentedControl()
    • UISegmentedControl

      protected UISegmentedControl​(NSObject.Handle h, long handle)
    • UISegmentedControl

      protected UISegmentedControl​(NSObject.SkipInit skipInit)
    • UISegmentedControl

      public UISegmentedControl​(CGRect frame)
    • UISegmentedControl

      public UISegmentedControl​(NSCoder coder)
    • UISegmentedControl

      public UISegmentedControl​(NSArray<?> items)
    • UISegmentedControl

      public UISegmentedControl​(CGRect frame, NSArray<UIAction> actions)
      Since:
      Available in iOS 14.0 and later.
    • UISegmentedControl

      public UISegmentedControl​(CGRect frame, UIAction primaryAction)
      Since:
      Available in iOS 14.0 and later.
    • UISegmentedControl

      public UISegmentedControl​(String... items)
    • UISegmentedControl

      public UISegmentedControl​(UIImage... items)
  • Method Details

    • getControlStyle

      @Deprecated public UISegmentedControlStyle getControlStyle()
      Deprecated.
      Deprecated in iOS 7.0. The segmentedControlStyle property no longer has any effect
    • setControlStyle

      @Deprecated public void setControlStyle​(UISegmentedControlStyle v)
      Deprecated.
      Deprecated in iOS 7.0. The segmentedControlStyle property no longer has any effect
    • isMomentary

      public boolean isMomentary()
    • setMomentary

      public void setMomentary​(boolean v)
    • getNumberOfSegments

      public long getNumberOfSegments()
    • apportionsSegmentWidthsByContent

      public boolean apportionsSegmentWidthsByContent()
    • setApportionsSegmentWidthsByContent

      public void setApportionsSegmentWidthsByContent​(boolean v)
    • getSelectedSegment

      public long getSelectedSegment()
    • setSelectedSegment

      public void setSelectedSegment​(long v)
    • getSelectedSegmentTintColor

      public UIColor getSelectedSegmentTintColor()
      Since:
      Available in iOS 13.0 and later.
    • setSelectedSegmentTintColor

      public void setSelectedSegmentTintColor​(UIColor v)
      Since:
      Available in iOS 13.0 and later.
    • getLayerClass

      public static Class<? extends CALayer> getLayerClass()
    • isSpringLoaded

      public boolean isSpringLoaded()
      Specified by:
      isSpringLoaded in interface UISpringLoadedInteractionSupporting
      Since:
      Available in iOS 11.0 and later.
    • setSpringLoaded

      public void setSpringLoaded​(boolean v)
      Specified by:
      setSpringLoaded in interface UISpringLoadedInteractionSupporting
      Since:
      Available in iOS 11.0 and later.
    • setTitleTextAttributes

      public void setTitleTextAttributes​(NSAttributedStringAttributes attributes, UIControlState state)
      Since:
      Available in iOS 5.0 and later.
    • setTitleTextMarkupAttributes

      public void setTitleTextMarkupAttributes​(CMTextMarkupAttributes attributes, UIControlState state)
      Since:
      Available in iOS 5.0 and later.
    • setTitleCoreTextAttributes

      public void setTitleCoreTextAttributes​(CTAttributedStringAttributes attributes, UIControlState state)
      Since:
      Available in iOS 5.0 and later.
    • getTitleTextAttributes

      public NSAttributedStringAttributes getTitleTextAttributes​(UIControlState state)
      Since:
      Available in iOS 5.0 and later.
    • getTitleTextMarkupAttributes

      public CMTextMarkupAttributes getTitleTextMarkupAttributes​(UIControlState state)
      Since:
      Available in iOS 5.0 and later.
    • getTitleCoreTextAttributes

      public CTAttributedStringAttributes getTitleCoreTextAttributes​(UIControlState state)
      Since:
      Available in iOS 5.0 and later.
    • init

      protected long init​(CGRect frame)
      Overrides:
      init in class UIControl
    • init

      protected long init​(NSCoder coder)
      Overrides:
      init in class UIControl
    • init

      protected long init​(NSArray<?> items)
    • init

      protected long init​(CGRect frame, NSArray<UIAction> actions)
      Since:
      Available in iOS 14.0 and later.
    • insertSegment

      public void insertSegment​(UIAction action, long segment, boolean animated)
      Since:
      Available in iOS 14.0 and later.
    • setAction

      public void setAction​(UIAction action, long segment)
      Since:
      Available in iOS 14.0 and later.
    • actionForSegmentAtIndex

      public UIAction actionForSegmentAtIndex​(long segment)
      Since:
      Available in iOS 14.0 and later.
    • segmentIndexForActionIdentifier

      public long segmentIndexForActionIdentifier​(UIActionIdentifier actionIdentifier)
      Since:
      Available in iOS 14.0 and later.
    • insertSegment

      public void insertSegment​(String title, long segment, boolean animated)
    • insertSegment

      public void insertSegment​(UIImage image, long segment, boolean animated)
    • removeSegment

      public void removeSegment​(long segment, boolean animated)
    • removeAllSegments

      public void removeAllSegments()
    • setTitle

      public void setTitle​(String title, long segment)
    • getTitle

      public String getTitle​(long segment)
    • setImage

      public void setImage​(UIImage image, long segment)
    • getImage

      public UIImage getImage​(long segment)
    • setWidth

      public void setWidth​(double width, long segment)
    • getWidth

      public double getWidth​(long segment)
    • setContentOffset

      public void setContentOffset​(CGSize offset, long segment)
    • getContentOffset

      public CGSize getContentOffset​(long segment)
    • setEnabled

      public void setEnabled​(boolean enabled, long segment)
    • isEnabled

      public boolean isEnabled​(long segment)
    • setBackgroundImage

      public void setBackgroundImage​(UIImage backgroundImage, UIControlState state, UIBarMetrics barMetrics)
    • getBackgroundImage

      public UIImage getBackgroundImage​(UIControlState state, UIBarMetrics barMetrics)
    • setDividerImage

      public void setDividerImage​(UIImage dividerImage, UIControlState leftState, UIControlState rightState, UIBarMetrics barMetrics)
    • getDividerImage

      public UIImage getDividerImage​(UIControlState leftState, UIControlState rightState, UIBarMetrics barMetrics)
    • setTitleTextAttributesDictionary

      public void setTitleTextAttributesDictionary​(NSDictionary<NSString,​?> attributes, UIControlState state)
    • getTitleTextAttributesDictionary

      public NSDictionary<NSString,​?> getTitleTextAttributesDictionary​(UIControlState state)
    • setContentPositionAdjustment

      public void setContentPositionAdjustment​(UIOffset adjustment, UISegmentedControlSegment leftCenterRightOrAlone, UIBarMetrics barMetrics)
    • getContentPositionAdjustment

      public UIOffset getContentPositionAdjustment​(UISegmentedControlSegment leftCenterRightOrAlone, UIBarMetrics barMetrics)
    • getUserInterfaceLayoutDirection

      public static UIUserInterfaceLayoutDirection getUserInterfaceLayoutDirection​(UISemanticContentAttribute attribute)
      Since:
      Available in iOS 9.0 and later.
    • getUserInterfaceLayoutDirection

      public static UIUserInterfaceLayoutDirection getUserInterfaceLayoutDirection​(UISemanticContentAttribute semanticContentAttribute, UIUserInterfaceLayoutDirection layoutDirection)
      Since:
      Available in iOS 10.0 and later.