public class UISwitch extends UIControl
NoIntrinsicMetric| Constructor and Description |
|---|
UISwitch()
Constructs a default UISwitch object located at (0,0) with 0 weight and 0
height.
|
UISwitch(CGRect rect)
Constructs a UISwitch object initialized with the dimensions and position
specified in the rect parameter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
drawRect(CGRect rect)
This method is implicitly called when a view is first displayed or when
an event occurs that invalidates a visible part of the view and the view
needs to be redrawn.
|
boolean |
isOn()
Returns a Boolean that defines whether the switch is on or off.
|
UIColor |
onTintColor()
Returns the color of the switch used when it is turned on.
|
void |
setFrame(CGRect frame)
Sets view's dimensions and position according to the structure specified
as frame parameter.
|
void |
setOn(boolean on)
Sets the state of the switch (on or off).
|
void |
setOn(boolean on,
boolean animated)
Changes changes the state of switch ( on or off) using animation or not.
|
void |
setOnTintColor(UIColor onTintColor)
Sets the color of the switch used when it is turned on.
|
void |
setThumbTintColor(UIColor thumbTintColor)
Sets the color of the thumb.
|
void |
setTintColor(UIColor tintColor)
Sets the tint color of this view as defined by the specified parameter.
|
UIColor |
thumbTintColor()
Returns the color of the thumb.
|
UIColor |
tintColor()
Returns the non-default tint color value of the short distant view in the
view hierarchy.
|
void |
touchesBegan(Set<UITouch> touches,
UIEvent event)
Sent to this responder when one or more fingers touched the screen.
|
void |
touchesCancelled(Set<UITouch> touches,
UIEvent event)
Sent to this responder when touch event has been canceled.
|
void |
touchesEnded(Set<UITouch> touches,
UIEvent event)
Sent to this responder when one or more fingers were lifted from the
screen.
|
void |
touchesMoved(Set<UITouch> touches,
UIEvent event)
Sent to this responder when one or more fingers move on the screen.
|
addTarget, allTargets, contentHorizontalAlignment, contentVerticalAlignment, hitTest, isEnabled, isHighlighted, isSelected, removeTarget, sendActionsForControlEvents, setContentHorizontalAlignment, setContentVerticalAlignment, setEnabled, setHighlighted, setSelected, stateaccessibilityIdentifier, 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, frame, gestureRecognizers, heightAnchor, insertSubview, insetsLayoutMarginsFromSafeArea, intrinsicContentSize, invalidateIntrinsicContentSize, isHidden, isMultipleTouchEnabled, isOpaque, isUserInteractionEnabled, layer, layoutIfNeeded, layoutMargins, layoutMarginsDidChange, layoutMarginsGuide, layoutSubviews, 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, setGestureRecognizers, setHidden, setInsetsLayoutMarginsFromSafeArea, setLayoutMargins, setMaskView, setMultipleTouchEnabled, setNeedsDisplay, setNeedsLayout, setNeedsUpdateConstraints, setOpaque, setOverrideUserInterfaceStyle, setPreservesSuperviewLayoutMargins, setRestorationIdentifier, setTag, setTintAdjustmentMode, setTransform, setTranslatesAutoresizingMaskIntoConstraints, setUserInteractionEnabled, sizeThatFits, sizeToFit, subviews, superview, tag, tintAdjustmentMode, 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 UISwitch()
public UISwitch(CGRect rect)
rect - CGRect that defines dimension and position of the UISwitch.public void setFrame(CGRect frame)
UIViewpublic void touchesBegan(Set<UITouch> touches, UIEvent event)
UIRespondertouchesBegan in class UIControltouches - The set touches to which the touch or touches belongs.event - The event to which the touches belong.public void touchesMoved(Set<UITouch> touches, UIEvent event)
UIRespondertouchesMoved in class UIControltouches - The set touches to which the touch or touches belongs.event - The event to which the touches belong.public void touchesEnded(Set<UITouch> touches, UIEvent event)
UIRespondertouchesEnded in class UIControltouches - The set touches to which the touch or touches belongs.event - The event to which the touches belong.public void touchesCancelled(Set<UITouch> touches, UIEvent event)
UIRespondertouchesCancelled in class UIControltouches - The set touches to which the touch belongs.event - The event to which the touches belong.public boolean isOn()
public void setOn(boolean on)
on - TRUE sets the switch on.public void setOn(boolean on,
boolean animated)
on - TRUE sets the switch on.animated - TRUE animates the change.public UIColor thumbTintColor()
public void setThumbTintColor(UIColor thumbTintColor)
thumbTintColor - The color of the thumb.public UIColor tintColor()
UIViewpublic void setTintColor(UIColor tintColor)
UIViewsetTintColor in class UIViewtintColor - The new tint color of this view.UIColorpublic UIColor onTintColor()
public void setOnTintColor(UIColor onTintColor)
onTintColor - The color of the switch used when it is turned on.Copyright © 2020. All rights reserved.