public class UIButton extends UIControl
NoIntrinsicMetric
Modifier and Type | Method and Description |
---|---|
boolean |
adjustsImageWhenDisabled()
Returns a value that shows this button changes image when it is disabled.
|
boolean |
adjustsImageWhenHighlighted()
Returns a value that shows this button changes image when it is
highlighted.
|
UIImage |
backgroundImageForState(int UIControlState)
Returns a background image that is used for the specified state of this
button.
|
int |
buttonType()
Returns the button type.
|
static UIButton |
buttonWithType(int UIButtonType)
Constructs a UIButton object initialized with the given type.
|
UIEdgeInsets |
contentEdgeInsets()
Retrieve the insets of the view content.
|
UIImage |
currentBackgroundImage()
Returns the background image of this button.
|
UIImage |
currentImage()
Returns the image displayed on the button.
|
String |
currentTitle()
Returns title the displayed on this button.
|
UIColor |
currentTitleColor()
Returns the color of the title.
|
UIColor |
currentTitleShadowColor()
Returns the color of the title’s shadow.
|
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.
|
UIEdgeInsets |
imageEdgeInsets()
Retrieve the insets of the foreground image.
|
UIImage |
imageForState(int UIControlState)
Returns a image that is used for the specified state of this button.
|
UIImageView |
imageView()
Returns button’s image view.
|
CGSize |
intrinsicContentSize()
Returns the natural size of this view.
|
void |
layoutSubviews()
Changes the layout of this view's subviews.
|
void |
setAdjustsImageWhenDisabled(boolean adjustsImageWhenDisabled)
Sets a value that defines whether this button changes image when it is
disabled.
|
void |
setAdjustsImageWhenHighlighted(boolean adjustsImageWhenHighlighted)
Sets a value that defines whether this button changes image when it is
highlighted.
|
void |
setBackgroundImage(UIImage img,
int UIControlState)
Sets a background image to use for a specified state of this button.
|
void |
setContentEdgeInsets(UIEdgeInsets contentEdgeInsets)
Set the insets of the view content
|
void |
setContentHorizontalAlignment(int UIControlContentHorizontalAlignment)
Sets an integer that represents the horizontal alignment of the content
within the control.
|
void |
setEnabled(boolean enabled)
Sets a Boolean that defines whether the control is enabled or not.
|
void |
setFrame(CGRect frame)
Sets view's dimensions and position according to the structure specified
as frame parameter.
|
void |
setHighlighted(boolean highlighted)
Sets the control to highlighted state according to the Boolean parameter.
|
void |
setImage(UIImage img,
int UIControlState)
Sets the image to use for the specified state of this button.
|
void |
setImageEdgeInsets(UIEdgeInsets imageEdgeInsets)
Set the insets of the foreground image
|
void |
setSelected(boolean selected)
Sets this control to selected state or not according to Boolean
parameter.
|
void |
setShowsTouchWhenHighlighted(boolean showsTouchWhenHighlighted)
Sets a value that defines whether this button is highlighted or not when
tapped.
|
void |
setTitle(String title,
int UIControlState)
Sets the title for the specified state.
|
void |
setTitleColor(UIColor titleColor,
int UIControlState)
Sets the color for title to use for the specified state.
|
void |
setTitleEdgeInsets(UIEdgeInsets titleEdgeInsets)
Set the insets of the text
|
void |
setTitleShadowColor(UIColor shadowcolor,
int UIControlState)
Sets the color for title shadow to use for the specified state.
|
boolean |
showsTouchWhenHighlighted()
Returns a value that shows whether this button is highlighted or not
after tapping.
|
void |
tintColorDidChange() |
UIColor |
titleColorForState(int UIControlState)
Returns the color of the title for the specified state.
|
UIEdgeInsets |
titleEdgeInsets()
Retrieve the insets of the text.
|
String |
titleForState(int UIControlState)
Returns the title for the specified state.
|
UILabel |
titleLabel()
Returns a label that displays button’s title.
|
UIColor |
titleShadowColorForState(int UIControlState)
Returns the color of title shadow for the specified state.
|
UIView |
viewForFirstBaselineLayout()
Returns a view that is suitable for the top row baseline
|
UIView |
viewForLastBaselineLayout()
Returns a view that is suitable for the bottom row baseline.
|
addTarget, allTargets, contentHorizontalAlignment, contentVerticalAlignment, hitTest, isEnabled, isHighlighted, isSelected, removeTarget, sendActionsForControlEvents, setContentVerticalAlignment, state, touchesBegan, touchesCancelled, touchesEnded, touchesMoved
accessibilityIdentifier, 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, 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, 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, topAnchor, toString, trailingAnchor, transform, transitionWithView, translatesAutoresizingMaskIntoConstraints, updateConstraints, updateConstraintsIfNeeded, userInterfaceLayoutDirection, widthAnchor, willMoveToSuperview, willMoveToWindow, willRemoveSubview, window
becomeFirstResponder, isFirstResponder, resignFirstResponder
addObserver, observeValueForKeyPath, performSelector, performSelectorOnMainThread, release, removeObserver, removeObserver, retain, setValueForKey, setValueForUndefinedKey, valueForKey, valueForUndefinedKey
public static UIButton buttonWithType(int UIButtonType)
UIButtonType
- Specifies the style of a button.UIControlState
public void setFrame(CGRect frame)
UIView
public void setImageEdgeInsets(UIEdgeInsets imageEdgeInsets)
imageEdgeInsets
- The image insetspublic UIEdgeInsets imageEdgeInsets()
public void setContentEdgeInsets(UIEdgeInsets contentEdgeInsets)
contentEdgeInsets
- The content insetspublic UIEdgeInsets contentEdgeInsets()
public void setTitleEdgeInsets(UIEdgeInsets titleEdgeInsets)
titleEdgeInsets
- The image insetspublic UIEdgeInsets titleEdgeInsets()
public void layoutSubviews()
UIView
layoutSubviews
in class UIView
public int buttonType()
UIControlState
public UILabel titleLabel()
public UIImageView imageView()
public String currentTitle()
public String titleForState(int UIControlState)
UIControlState
- The state that uses the specified title.UIControlState
public void setTitle(String title, int UIControlState)
title
- The title for the specified state.UIControlState
- The state that uses the specified title.UIControlState
public UIColor currentTitleColor()
public UIColor titleColorForState(int UIControlState)
UIControlState
- The state that uses the specified color.public void setTitleColor(UIColor titleColor, int UIControlState)
titleColor
- The color of the title for the specified state.UIControlState
- The specified state that uses the specified color.UIControlState
public UIColor titleShadowColorForState(int UIControlState)
UIControlState
- The state that uses the specified color.UIControlState
public UIColor currentTitleShadowColor()
public void setTitleShadowColor(UIColor shadowcolor, int UIControlState)
shadowcolor
- The color of the title shadow.UIControlState
- The specified state that uses the specified color.UIControlState
public UIImage currentImage()
public UIImage imageForState(int UIControlState)
UIControlState
- The specified state of the button.UIControlState
public void setImage(UIImage img, int UIControlState)
img
- The image to use for the specified state.UIControlState
- The specified state that uses the specified image.UIControlState
public UIImage currentBackgroundImage()
public UIImage backgroundImageForState(int UIControlState)
UIControlState
- The specified state of the button.UIControlState
public void setBackgroundImage(UIImage img, int UIControlState)
img
- The background image to use for the specified state.UIControlState
- The specified state that uses the specified image.UIControlState
public boolean adjustsImageWhenDisabled()
public void setAdjustsImageWhenDisabled(boolean adjustsImageWhenDisabled)
adjustsImageWhenDisabled
- A Boolean value that defines whether this
button changes image when it is disabled.public boolean adjustsImageWhenHighlighted()
public void setAdjustsImageWhenHighlighted(boolean adjustsImageWhenHighlighted)
adjustsImageWhenHighlighted
- A Boolean value that defines whether
this button changes image when it is highlighted.public boolean showsTouchWhenHighlighted()
public void setShowsTouchWhenHighlighted(boolean showsTouchWhenHighlighted)
showsTouchWhenHighlighted
- A Boolean that defines whether the
button is highlighted or not.public void setHighlighted(boolean highlighted)
UIControl
setHighlighted
in class UIControl
highlighted
- A Boolean that defines whether the control is
highlighted or not.public void setSelected(boolean selected)
UIControl
setSelected
in class UIControl
selected
- A Boolean that defines whether this control is in
selected state.public void setEnabled(boolean enabled)
UIControl
setEnabled
in class UIControl
enabled
- A Boolean that defines whether the control is enabled or
not.public void drawRect(CGRect rect)
UIView
public CGSize intrinsicContentSize()
UIView
intrinsicContentSize
in class UIView
public UIView viewForLastBaselineLayout()
UIView
viewForLastBaselineLayout
in class UIView
public UIView viewForFirstBaselineLayout()
UIView
viewForFirstBaselineLayout
in class UIView
public void setContentHorizontalAlignment(int UIControlContentHorizontalAlignment)
UIControl
setContentHorizontalAlignment
in class UIControl
UIControlContentHorizontalAlignment
- An integer that represents the
horizontal alignment of the content within the control.public void tintColorDidChange()
tintColorDidChange
in class UIView
Copyright © 2020. All rights reserved.