public class UISegmentedControl extends UIControl
NoIntrinsicMetric| Constructor and Description |
|---|
UISegmentedControl()
Constructs a default UISegmentedControl object located at (0,0) with 0
weight and 0 height.
|
UISegmentedControl(CGRect rect)
Constructs a UIWindow object initialized with the dimensions and position
specified in the rect parameter.
|
UISegmentedControl(List<?> items)
Initializes and returns a segmented control with segments having the
given titles or images.
|
| Modifier and Type | Method and Description |
|---|---|
UIImage |
imageForSegmentAtIndex(int index)
Returns the image for the segment of the specified index.
|
void |
insertSegmentWithImage(UIImage img,
int index,
boolean animated)
Inserts the specified image to the segment of the given index, using
animation or not.
|
void |
insertSegmentWithTitle(String title,
int index,
boolean animated)
Inserts the specified title to the segment of the given index, using
animation or not.
|
boolean |
isMomentary()
Returns a Boolean that show whether segments show the selected state.
|
void |
layoutSubviews()
Changes the layout of this view's subviews.
|
int |
numberOfSegments()
Returns the number of segments.
|
void |
removeAllSegments()
Removes all the segments.
|
void |
removeSegmentAtIndex(int index,
boolean animated)
Removes the segment at the specified index using animation or not.
|
int |
segmentedControlStyle()
Deprecated.
|
int |
selectedSegmentIndex()
Returns the index of the selected segment.
|
void |
setImage(UIImage image,
int index)
Sets the specified image to the segment of the specified index.
|
void |
setMomentary(boolean momentary)
Sets a Boolean that defines whether segments show the selected state.
|
void |
setSegmentedControlStyle(int UISegmentedControlStyle)
Deprecated.
|
void |
setSelectedSegmentIndex(int index)
Sets the index for the selected segment.
|
void |
setTitle(String title,
int index)
Sets the title of a segment.
|
String |
titleForSegmentAtIndex(int index)
Returns the title of the segment at the specified index.
|
addTarget, allTargets, contentHorizontalAlignment, contentVerticalAlignment, hitTest, isEnabled, isHighlighted, isSelected, removeTarget, sendActionsForControlEvents, setContentHorizontalAlignment, setContentVerticalAlignment, setEnabled, setHighlighted, setSelected, state, touchesBegan, touchesCancelled, touchesEnded, touchesMovedaccessibilityIdentifier, addConstraint, addConstraints, addGestureRecognizer, addLayoutGuide, addSubview, alpha, animateWithDuration, animateWithDuration, animateWithDuration, areAnimationsEnabled, autoresizesSubviews, autoresizingMask, backgroundColor, bottomAnchor, bounds, bringSubviewToFront, center, centerXAnchor, centerYAnchor, clipsToBounds, constraints, contentCompressionResistancePriorityForAxis, contentHuggingPriorityForAxis, contentMode, convertPointFromView, convertPointToView, convertRectFromView, convertRectToView, didAddSubview, didMoveToSuperview, didMoveToWindow, drawRect, frame, gestureRecognizers, heightAnchor, insertSubview, insetsLayoutMarginsFromSafeArea, intrinsicContentSize, invalidateIntrinsicContentSize, isHidden, isMultipleTouchEnabled, isOpaque, isUserInteractionEnabled, layer, layoutIfNeeded, layoutMargins, layoutMarginsDidChange, layoutMarginsGuide, leadingAnchor, leftAnchor, maskView, needsUpdateConstraints, nextResponder, overrideUserInterfaceStyle, pointInside, preservesSuperviewLayoutMargins, removeConstraint, removeConstraints, removeFromSuperview, removeGestureRecognizer, removeLayoutGuide, requiresConstraintBasedLayout, restorationIdentifier, rightAnchor, safeAreaInsets, safeAreaLayoutGuide, sendSubviewToBack, setAccessibilityIdentifier, setAlpha, setAnimationBeginsFromCurrentState, setAnimationCurve, setAnimationDelay, setAnimationDuration, setAnimationRepeatAutoreverses, setAnimationRepeatCount, setAnimationsEnabled, setAnimationStartDate, setAutoresizesSubviews, setAutoresizingMask, setBackgroundColor, setBounds, setCenter, setClearsContextBeforeDrawing, setClipsToBounds, setContentCompressionResistancePriority, setContentHuggingPriority, setContentMode, setFrame, setGestureRecognizers, setHidden, setInsetsLayoutMarginsFromSafeArea, setLayoutMargins, setMaskView, setMultipleTouchEnabled, setNeedsDisplay, setNeedsLayout, setNeedsUpdateConstraints, setOpaque, setOverrideUserInterfaceStyle, setPreservesSuperviewLayoutMargins, setRestorationIdentifier, setTag, setTintAdjustmentMode, setTintColor, setTransform, setTranslatesAutoresizingMaskIntoConstraints, setUserInteractionEnabled, sizeThatFits, sizeToFit, subviews, superview, tag, tintAdjustmentMode, tintColor, tintColorDidChange, topAnchor, toString, trailingAnchor, transform, transitionWithView, translatesAutoresizingMaskIntoConstraints, updateConstraints, updateConstraintsIfNeeded, userInterfaceLayoutDirection, viewForFirstBaselineLayout, viewForLastBaselineLayout, widthAnchor, willMoveToSuperview, willMoveToWindow, willRemoveSubview, windowbecomeFirstResponder, isFirstResponder, resignFirstResponderaddObserver, observeValueForKeyPath, performSelector, performSelectorOnMainThread, release, removeObserver, removeObserver, retain, setValueForKey, setValueForUndefinedKey, valueForKey, valueForUndefinedKeypublic UISegmentedControl()
public UISegmentedControl(CGRect rect)
rect - CGRect that defines dimension and position of UIWindow.public UISegmentedControl(List<?> items)
items - An List of String objects (for segment titles) or UIImage
objects (for segment images).public void setTitle(String title, int index)
title - The title of a segment.index - The index of the segment.public String titleForSegmentAtIndex(int index)
index - The index of the segment.public void setImage(UIImage image, int index)
image - The image for the segment.index - The index of the segment.public UIImage imageForSegmentAtIndex(int index)
index - The index of the segment.public void insertSegmentWithTitle(String title, int index, boolean animated)
title - The title for the segment.index - The index that specifies the segment.animated - TRUE the change is animated.public void insertSegmentWithImage(UIImage img, int index, boolean animated)
img - The image for the segment.index - The index that specifies the segment.animated - TRUE the change is animated.public void removeAllSegments()
public void removeSegmentAtIndex(int index,
boolean animated)
index - The index that specifies the segment.animated - TRUE the change is animated.public int numberOfSegments()
public int selectedSegmentIndex()
public void setSelectedSegmentIndex(int index)
index - The index of the selected segment.@Deprecated public int segmentedControlStyle()
@Deprecated public void setSegmentedControlStyle(int UISegmentedControlStyle)
UISegmentedControlStyle - The style of the segmented control.UISegmentedControlStylepublic boolean isMomentary()
public void setMomentary(boolean momentary)
momentary - A Boolean that defines whether segments show the
selected state.public void layoutSubviews()
UIViewlayoutSubviews in class UIViewCopyright © 2020. All rights reserved.