Package apple.uikit

Class UISegmentedControl

    • Constructor Detail

      • UISegmentedControl

        protected UISegmentedControl​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static UISegmentedControl allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • appearanceForTraitCollectionWhenContainedIn

        @NotNull
        @Deprecated
        public static @NotNull UISegmentedControl appearanceForTraitCollectionWhenContainedIn​(@NotNull
                                                                                              @NotNull UITraitCollection trait,
                                                                                              @Nullable
                                                                                              @Nullable UIAppearanceContainer ContainerClass,
                                                                                              java.lang.Object... varargs)
        Deprecated.
      • appearanceForTraitCollectionWhenContainedInInstancesOfClasses

        @NotNull
        public static @NotNull UISegmentedControl appearanceForTraitCollectionWhenContainedInInstancesOfClasses​(@NotNull
                                                                                                                @NotNull UITraitCollection trait,
                                                                                                                @NotNull
                                                                                                                @NotNull NSArray<?> containerTypes)
      • appearanceWhenContainedIn

        @NotNull
        @Deprecated
        public static @NotNull UISegmentedControl appearanceWhenContainedIn​(@Nullable
                                                                            @Nullable UIAppearanceContainer ContainerClass,
                                                                            java.lang.Object... varargs)
        Deprecated.
      • appearanceWhenContainedInInstancesOfClasses

        @NotNull
        public static @NotNull UISegmentedControl appearanceWhenContainedInInstancesOfClasses​(@NotNull
                                                                                              @NotNull NSArray<?> containerTypes)
      • areAnimationsEnabled

        public static boolean areAnimationsEnabled()
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • beginAnimationsContext

        @Deprecated
        public static void beginAnimationsContext​(@Nullable
                                                  @Nullable java.lang.String animationID,
                                                  @Nullable
                                                  @Nullable org.moe.natj.general.ptr.VoidPtr context)
        Deprecated.
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • clearTextInputContextIdentifier

        public static void clearTextInputContextIdentifier​(@NotNull
                                                           @NotNull java.lang.String identifier)
      • commitAnimations

        @Deprecated
        public static void commitAnimations()
        Deprecated.
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • inheritedAnimationDuration

        public static double inheritedAnimationDuration()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • layerClass

        @NotNull
        public static @NotNull org.moe.natj.objc.Class layerClass()
      • requiresConstraintBasedLayout

        public static boolean requiresConstraintBasedLayout()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setAnimationBeginsFromCurrentState

        @Deprecated
        public static void setAnimationBeginsFromCurrentState​(boolean fromCurrentState)
        Deprecated.
      • setAnimationCurve

        @Deprecated
        public static void setAnimationCurve​(long curve)
        Deprecated.
      • setAnimationDelay

        @Deprecated
        public static void setAnimationDelay​(double delay)
        Deprecated.
      • setAnimationDelegate

        @Deprecated
        public static void setAnimationDelegate​(@Nullable
                                                @Nullable java.lang.Object delegate)
        Deprecated.
      • setAnimationDidStopSelector

        @Deprecated
        public static void setAnimationDidStopSelector​(@Nullable
                                                       @Nullable org.moe.natj.objc.SEL selector)
        Deprecated.
      • setAnimationDuration_static

        @Deprecated
        public static void setAnimationDuration_static​(double duration)
        Deprecated.
      • setAnimationRepeatAutoreverses

        @Deprecated
        public static void setAnimationRepeatAutoreverses​(boolean repeatAutoreverses)
        Deprecated.
      • setAnimationRepeatCount_static

        @Deprecated
        public static void setAnimationRepeatCount_static​(float repeatCount)
        Deprecated.
      • setAnimationStartDate

        @Deprecated
        public static void setAnimationStartDate​(@NotNull
                                                 @NotNull NSDate startDate)
        Deprecated.
      • setAnimationTransitionForViewCache

        @Deprecated
        public static void setAnimationTransitionForViewCache​(long transition,
                                                              @NotNull
                                                              @NotNull UIView view,
                                                              boolean cache)
        Deprecated.
      • setAnimationWillStartSelector

        @Deprecated
        public static void setAnimationWillStartSelector​(@Nullable
                                                         @Nullable org.moe.natj.objc.SEL selector)
        Deprecated.
      • setAnimationsEnabled

        public static void setAnimationsEnabled​(boolean enabled)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • userInterfaceLayoutDirectionForSemanticContentAttribute

        public static long userInterfaceLayoutDirectionForSemanticContentAttribute​(long attribute)
      • userInterfaceLayoutDirectionForSemanticContentAttributeRelativeToLayoutDirection

        public static long userInterfaceLayoutDirectionForSemanticContentAttributeRelativeToLayoutDirection​(long semanticContentAttribute,
                                                                                                            long layoutDirection)
      • version_static

        public static long version_static()
      • _appearance

        @NotNull
        public @NotNull UISegmentedControl _appearance()
        Description copied from interface: UIAppearance
        To customize the appearance of all instances of a class, send the relevant appearance modification messages to the appearance proxy for the class. For example, to modify the bar tint color for all UINavigationBar instances: [[UINavigationBar appearance] setBarTintColor:myColor]; Note for iOS7: On iOS7 the tintColor property has moved to UIView, and now has special inherited behavior described in UIView.h. This inherited behavior can conflict with the appearance proxy, and therefore tintColor is now disallowed with the appearance proxy.
        Specified by:
        _appearance in interface UIAppearance
        Overrides:
        _appearance in class UIControl
      • _appearanceWhenContainedIn

        @NotNull
        @Deprecated
        public @NotNull UISegmentedControl _appearanceWhenContainedIn​(@Nullable
                                                                      @Nullable UIAppearanceContainer ContainerClass,
                                                                      java.lang.Object... varargs)
        Deprecated.
        Description copied from interface: UIAppearance
        To customize the appearances for instances of a class contained within an instance of a container class, or instances in a hierarchy, use +appearanceWhenContainedInInstancesOfClasses: for the appropriate appearance proxy. For example: [[UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[UISplitViewController class]]] setBarTintColor:myColor]; [[UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[UITabBarController class], [UISplitViewController class]]] setBarTintColor:myTabbedNavBarColor]; In any given view hierarchy the outermost appearance proxy wins. Specificity (depth of the chain) is the tie-breaker. In other words, the containment statement is treated as a partial ordering. Given a concrete ordering (actual subview hierarchy), we select the partial ordering that is the first unique match when reading the actual hierarchy from the window down. API-Since: 5.0 Deprecated-Since: 9.0
        Specified by:
        _appearanceWhenContainedIn in interface UIAppearance
        Overrides:
        _appearanceWhenContainedIn in class UIControl
      • apportionsSegmentWidthsByContent

        public boolean apportionsSegmentWidthsByContent()
        For segments whose width value is 0, setting this property to YES attempts to adjust segment widths based on their content widths. Default is NO. API-Since: 5.0
      • backgroundImageForStateBarMetrics

        @Nullable
        public @Nullable UIImage backgroundImageForStateBarMetrics​(long state,
                                                                   long barMetrics)
        API-Since: 5.0
      • contentOffsetForSegmentAtIndex

        public CGSize contentOffsetForSegmentAtIndex​(long segment)
      • contentPositionAdjustmentForSegmentTypeBarMetrics

        public UIOffset contentPositionAdjustmentForSegmentTypeBarMetrics​(long leftCenterRightOrAlone,
                                                                          long barMetrics)
        API-Since: 5.0
      • dividerImageForLeftSegmentStateRightSegmentStateBarMetrics

        @Nullable
        public @Nullable UIImage dividerImageForLeftSegmentStateRightSegmentStateBarMetrics​(long leftState,
                                                                                            long rightState,
                                                                                            long barMetrics)
        API-Since: 5.0
      • imageForSegmentAtIndex

        @Nullable
        public @Nullable UIImage imageForSegmentAtIndex​(long segment)
      • initWithItems

        public UISegmentedControl initWithItems​(@Nullable
                                                @Nullable NSArray<?> items)
        Initializes the segmented control with the given items. Items may be NSStrings, UIImages, or (as of iOS 14.0) UIActions. When constructing from a UIAction segments will prefer images over titles when both are provided. The segmented control is automatically sized to fit content.
      • insertSegmentWithImageAtIndexAnimated

        public void insertSegmentWithImageAtIndexAnimated​(@Nullable
                                                          @Nullable UIImage image,
                                                          long segment,
                                                          boolean animated)
      • insertSegmentWithTitleAtIndexAnimated

        public void insertSegmentWithTitleAtIndexAnimated​(@Nullable
                                                          @Nullable java.lang.String title,
                                                          long segment,
                                                          boolean animated)
        insert before segment number. 0..#segments. value pinned
      • isEnabledForSegmentAtIndex

        public boolean isEnabledForSegmentAtIndex​(long segment)
      • isMomentary

        public boolean isMomentary()
        if set, then we don't keep showing selected state after tracking ends. default is NO
      • setMomentary

        public void setMomentary​(boolean value)
        if set, then we don't keep showing selected state after tracking ends. default is NO
      • numberOfSegments

        public long numberOfSegments()
      • removeAllSegments

        public void removeAllSegments()
      • removeSegmentAtIndexAnimated

        public void removeSegmentAtIndexAnimated​(long segment,
                                                 boolean animated)
      • segmentedControlStyle

        @Deprecated
        public long segmentedControlStyle()
        Deprecated.
        API-Since: 2.0 Deprecated-Since: 7.0 Deprecated-Message: The segmentedControlStyle property no longer has any effect
      • selectedSegmentIndex

        public long selectedSegmentIndex()
        ignored in momentary mode. returns last segment pressed. default is UISegmentedControlNoSegment until a segment is pressed the UIControlEventValueChanged action is invoked when the segment changes via a user event. set to UISegmentedControlNoSegment to turn off selection
      • setApportionsSegmentWidthsByContent

        public void setApportionsSegmentWidthsByContent​(boolean value)
        For segments whose width value is 0, setting this property to YES attempts to adjust segment widths based on their content widths. Default is NO. API-Since: 5.0
      • setBackgroundImageForStateBarMetrics

        public void setBackgroundImageForStateBarMetrics​(@Nullable
                                                         @Nullable UIImage backgroundImage,
                                                         long state,
                                                         long barMetrics)
        If backgroundImage is an image returned from -[UIImage resizableImageWithCapInsets:] the cap widths will be calculated from that information, otherwise, the cap width will be calculated by subtracting one from the image's width then dividing by 2. The cap widths will also be used as the margins for text placement. To adjust the margin use the margin adjustment methods. In general, you should specify a value for the normal state to be used by other states which don't have a custom value set. Similarly, when a property is dependent on the bar metrics, be sure to specify a value for UIBarMetricsDefault. In the case of the segmented control, appearance properties for UIBarMetricsCompact are only respected for segmented controls in the smaller navigation and toolbars. API-Since: 5.0
      • setContentOffsetForSegmentAtIndex

        public void setContentOffsetForSegmentAtIndex​(CGSize offset,
                                                      long segment)
        adjust offset of image or text inside the segment. default is (0,0)
      • setContentPositionAdjustmentForSegmentTypeBarMetrics

        public void setContentPositionAdjustmentForSegmentTypeBarMetrics​(UIOffset adjustment,
                                                                         long leftCenterRightOrAlone,
                                                                         long barMetrics)
        For adjusting the position of a title or image within the given segment of a segmented control. API-Since: 5.0
      • setDividerImageForLeftSegmentStateRightSegmentStateBarMetrics

        public void setDividerImageForLeftSegmentStateRightSegmentStateBarMetrics​(@Nullable
                                                                                  @Nullable UIImage dividerImage,
                                                                                  long leftState,
                                                                                  long rightState,
                                                                                  long barMetrics)
        To customize the segmented control appearance you will need to provide divider images to go between two unselected segments (leftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal), selected on the left and unselected on the right (leftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal), and unselected on the left and selected on the right (leftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected). API-Since: 5.0
      • setEnabledForSegmentAtIndex

        public void setEnabledForSegmentAtIndex​(boolean enabled,
                                                long segment)
        default is YES
      • setImageForSegmentAtIndex

        public void setImageForSegmentAtIndex​(@Nullable
                                              @Nullable UIImage image,
                                              long segment)
        can only have image or title, not both. must be 0..#segments - 1 (or ignored). default is nil
      • setSegmentedControlStyle

        @Deprecated
        public void setSegmentedControlStyle​(long value)
        Deprecated.
        API-Since: 2.0 Deprecated-Since: 7.0 Deprecated-Message: The segmentedControlStyle property no longer has any effect
      • setSelectedSegmentIndex

        public void setSelectedSegmentIndex​(long value)
        ignored in momentary mode. returns last segment pressed. default is UISegmentedControlNoSegment until a segment is pressed the UIControlEventValueChanged action is invoked when the segment changes via a user event. set to UISegmentedControlNoSegment to turn off selection
      • setTitleForSegmentAtIndex

        public void setTitleForSegmentAtIndex​(@Nullable
                                              @Nullable java.lang.String title,
                                              long segment)
        can only have image or title, not both. must be 0..#segments - 1 (or ignored). default is nil
      • setTitleTextAttributesForState

        public void setTitleTextAttributesForState​(@Nullable
                                                   @Nullable NSDictionary<java.lang.String,​?> attributes,
                                                   long state)
        You may specify the font, text color, and shadow properties for the title in the text attributes dictionary, using the keys found in NSAttributedString.h. API-Since: 5.0
      • setWidthForSegmentAtIndex

        public void setWidthForSegmentAtIndex​(double width,
                                              long segment)
        set to 0.0 width to autosize. default is 0.0
      • titleForSegmentAtIndex

        @Nullable
        public @Nullable java.lang.String titleForSegmentAtIndex​(long segment)
      • titleTextAttributesForState

        @Nullable
        public @Nullable NSDictionary<java.lang.String,​?> titleTextAttributesForState​(long state)
        API-Since: 5.0
      • widthForSegmentAtIndex

        public double widthForSegmentAtIndex​(long segment)
      • selectedSegmentTintColor

        @Nullable
        public @Nullable UIColor selectedSegmentTintColor()
        The color to use for highlighting the currently selected segment. API-Since: 13.0
      • setSelectedSegmentTintColor

        public void setSelectedSegmentTintColor​(@Nullable
                                                @Nullable UIColor value)
        The color to use for highlighting the currently selected segment. API-Since: 13.0
      • actionForSegmentAtIndex

        @Nullable
        public @Nullable UIAction actionForSegmentAtIndex​(long segment)
        Fetch the action for the given segment, if one has been assigned to that segment API-Since: 14.0
      • initWithFrameActions

        public UISegmentedControl initWithFrameActions​(CGRect frame,
                                                       @NotNull
                                                       @NotNull NSArray<? extends UIAction> actions)
        Initializes the segmented control with the given frame and segments constructed from the given UIActions. Segments will prefer images over titles when both are provided. Selecting a segment calls UIAction.actionHandler as well as handlers for the ValueChanged and PrimaryActionTriggered control events. API-Since: 14.0
      • initWithFramePrimaryAction

        public UISegmentedControl initWithFramePrimaryAction​(CGRect frame,
                                                             @Nullable
                                                             @Nullable UIAction primaryAction)
        Description copied from class: UIControl
        Initializes the control and adds primaryAction for the UIControlEventPrimaryActionTriggered control event. Subclasses of UIControl may alter or add behaviors around the usage of primaryAction, see subclass documentation of this initializer for additional information. API-Since: 14.0
        Overrides:
        initWithFramePrimaryAction in class UIControl
      • insertSegmentWithActionAtIndexAnimated

        public void insertSegmentWithActionAtIndexAnimated​(@NotNull
                                                           @NotNull UIAction action,
                                                           long segment,
                                                           boolean animated)
        Insert a segment with the given action at the given index. Segments will prefer images over titles when both are provided. When the segment is selected UIAction.actionHandler is called. If a segment already exists with the action's identifier that segment will either be updated (if the index is the same) or it will be removed (if different). API-Since: 14.0
      • segmentIndexForActionIdentifier

        public long segmentIndexForActionIdentifier​(@NotNull
                                                    @NotNull java.lang.String actionIdentifier)
        Returns the index of the segment associated with the given actionIdentifier, or NSNotFound if the identifier could not be found. API-Since: 14.0
      • setActionForSegmentAtIndex

        public void setActionForSegmentAtIndex​(@NotNull
                                               @NotNull UIAction action,
                                               long segment)
        Reconfigures the given segment with this action. Segments will prefer images over titles when both are provided. When the segment is selected UIAction.actionHandler is called. UIAction.identifier must either match the action of the existing segment at this index, or be unique within all actions associated with the segmented control, or this method will assert. API-Since: 14.0
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.