public class UILabel extends UIView
NoIntrinsicMetric
Constructor and Description |
---|
UILabel()
Constructs a default UILabel object located at (0,0) with 0 weight and 0
height.
|
UILabel(CGRect frame)
Constructs a UILabel object using the specified rectangle.
|
Modifier and Type | Method and Description |
---|---|
boolean |
adjustsFontSizeToFitWidth()
Returns a Boolean that shows whether the font size of the title is
adjusted to label's size.
|
int |
baselineAdjustment()
Returns a number that shows how baselines are adjusted when text size
changes to fit the label.
|
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.
|
void |
drawTextInRect(CGRect rect)
Actual procedure of drawing text in this label
|
UIFont |
font()
Returns the font of the label's text.
|
UIColor |
highlightedTextColor()
Returns the highlight color of label's text.
|
boolean |
isHighlighted()
Returns a Boolean that shows whether this label is highlighted.
|
int |
lineBreakMode()
Returns the technique that is used to wrap and shorten the text of the
label.
|
double |
minimumScaleFactor()
Returns the minimum scale factor of label.
|
int |
numberOfLines()
Returns the maximum number of lines for rendering the text.
|
double |
preferredMaxLayoutWidth()
Returns the maximum width of a label with multiple lines.Expressed in
points.
|
void |
setAdjustsFontSizeToFitWidth(boolean adjustsFontSizeToFitWidth)
Sets a Boolean that defines whether the font size of the title should
adjust to label's size.
|
void |
setBaselineAdjustment(int baselineAdjustment)
Sets a value that defines how baselines are adjusted when text size
changes
|
void |
setFont(UIFont font)
Sets the font of the label's text.
|
void |
setFrame(CGRect frame)
Sets view's dimensions and position according to the structure specified
as frame parameter.
|
void |
setHighlighted(boolean highlighted)
Sets a Boolean that shows whether this label should be highlighted.
|
void |
setHighlightedTextColor(UIColor highlightedTextColor)
Sets the highlight color of label's text.
|
void |
setLineBreakMode(int NSLineBreakMode)
Sets technique to use in order to wrap and shorten the text of the label.
|
void |
setMinimumScaleFactor(double minimumScaleFactor)
Sets the minimum scale factor of label.
|
void |
setNumberOfLines(int numberOfLines)
Sets the maximum number of lines for rendering the text.
|
void |
setPreferredMaxLayoutWidth(double preferredMaxLayoutWidth)
Sets the maximum width of a label with multiple lines.
|
void |
setShadowColor(UIColor shadowColor)
Sets the shadow color of the text into the label.
|
void |
setShadowOffset(CGSize shadowOffset)
Sets the shadow offset for the label's text expressed in points.
|
void |
setText(String text)
Sets the text to be displayed on the label.
|
void |
setTextAlignment(int NSTextAlignment)
Sets the alignment technique for the text of the label.
|
void |
setTextColor(UIColor color)
Sets the color of the label's text.
|
UIColor |
shadowColor()
Returns the shadow color of the text into the label.
|
CGSize |
shadowOffset()
Returns the shadow offset of the label's text expressed in points.
|
String |
text()
Returns the text that is displayed on the label.
|
int |
textAlignment()
Returns the alignment technique for the text of the label.
|
UIColor |
textColor()
Returns the color of the label's text.
|
CGRect |
textRectForBounds(CGRect bounds,
int numberOfLines)
Calculate the required dimension for this UILabel, that the desired text could be drawn in
|
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, hitTest, 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, 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, window
becomeFirstResponder, isFirstResponder, resignFirstResponder, touchesBegan, touchesCancelled, touchesEnded, touchesMoved
addObserver, observeValueForKeyPath, performSelector, performSelectorOnMainThread, release, removeObserver, removeObserver, retain, setValueForKey, setValueForUndefinedKey, valueForKey, valueForUndefinedKey
public UILabel()
public UILabel(CGRect frame)
frame
- The rectangle in which to draw the textpublic void setFrame(CGRect frame)
UIView
public void setText(String text)
text
- The text to be displayed on the label.public String text()
public void setFont(UIFont font)
font
- The font of the label's text.public UIFont font()
public void setTextColor(UIColor color)
color
- The color of the label's text.public UIColor textColor()
public void setHighlighted(boolean highlighted)
highlighted
- A Boolean that shows whether this label should be
highlighted.public boolean isHighlighted()
public void setHighlightedTextColor(UIColor highlightedTextColor)
highlightedTextColor
- The highlight color of label's text.public UIColor highlightedTextColor()
public void setTextAlignment(int NSTextAlignment)
NSTextAlignment
- The alignment technique for the text of the label.NSTextAlignment
public int textAlignment()
public void setLineBreakMode(int NSLineBreakMode)
NSLineBreakMode
- The technique to use in order to wrap and shorten
the text of the label.public int lineBreakMode()
public void setNumberOfLines(int numberOfLines)
numberOfLines
- The maximum number of lines for rendering the text.public int numberOfLines()
public void setShadowOffset(CGSize shadowOffset)
shadowOffset
- The shadow offset for the label's text expressed in
points.public CGSize shadowOffset()
public void setShadowColor(UIColor shadowColor)
shadowColor
- The shadow color of the text into the label.public UIColor shadowColor()
public void setMinimumScaleFactor(double minimumScaleFactor)
minimumScaleFactor
- The minimum scale factor of label.public double minimumScaleFactor()
public void setPreferredMaxLayoutWidth(double preferredMaxLayoutWidth)
preferredMaxLayoutWidth
- The maximum width of a label with multiple
lines.public double preferredMaxLayoutWidth()
public void setBaselineAdjustment(int baselineAdjustment)
baselineAdjustment
- A value that defines how baselines are adjusted
when text size changespublic int baselineAdjustment()
public void setAdjustsFontSizeToFitWidth(boolean adjustsFontSizeToFitWidth)
adjustsFontSizeToFitWidth
- A Boolean that defines whether the font
size of the title should adjust to label's size.public boolean adjustsFontSizeToFitWidth()
public final void drawRect(CGRect rect)
UIView
public void drawTextInRect(CGRect rect)
rect
- the rectangle of the drawing areapublic CGRect textRectForBounds(CGRect bounds, int numberOfLines)
bounds
- the given size the area to draw intonumberOfLines
- the number of lines allowedCopyright © 2020. All rights reserved.