public class UITextField extends UIControl implements UITextInputTraits
NoIntrinsicMetric| Constructor and Description |
|---|
UITextField()
Constructs a default UITextField object located at (0,0) with 0 weight
and 0 height.
|
UITextField(CGRect rect)
Constructor for UITextField A UITextField object is a control that
displays editable text and sends an action message to a target object
when the user presses the return button.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
adjustsFontSizeToFitWidth()
Returns a Boolean that shows whether the font size is adjusted to fit the
size of this text field.
|
int |
autocapitalizationType()
Returns the type of auto-capitalization of the content of the text field.
|
int |
autocorrectionType()
Returns the type of auto-correction of the content of this text field.
|
boolean |
becomeFirstResponder()
Returns a Boolean that shows whether this UIResponder accepts to change
its status to first responder.
|
int |
borderStyle()
Returns border style of this text field.
|
UITextFieldDelegate |
delegate()
Returns the delegate of this text field.
|
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 |
enablesReturnKeyAutomatically()
Returns a Boolean that shows whether the return key is automatically
enabled.
|
UIFont |
font()
Returns font of this text field.
|
boolean |
isSecureTextEntry()
Returns a Boolean that shows whether the text that is being entered in
the text field is hidden.
|
int |
keyboardAppearance()
Returns the appearance type of the keyboard used along with the text
field.
|
int |
keyboardType()
Returns the style of the keyboard that is used along with the text field.
|
String |
placeholder()
Returns the text that is displayed when there is no text inserted in this
text field.
|
boolean |
resignFirstResponder()
Returns a Boolean that shows whether this UIResponder accepts to resign
its status as first responder.
|
int |
returnKeyType()
Returns the type of the return key.
|
void |
setAdjustsFontSizeToFitWidth(boolean adjustsFontSizeToFitWidth)
Set a Boolean that defines whether the font size should adjust to fit the
size of this text field.
|
void |
setAutocapitalizationType(int UITextAutocapitalizationType)
Sets the type of auto-capitalization for the content of the text field.
|
void |
setAutocorrectionType(int UITextAutocorrectionType)
Sets the type of auto-correction for the content of this text field.
|
void |
setBackgroundColor(UIColor background)
Set this view's background color.
|
void |
setBorderStyle(int UITextBorderStyle)
Sets the border style for this text field.
|
void |
setDelegate(UITextFieldDelegate delegate)
Sets the delegate for this text field.
|
void |
setEnablesReturnKeyAutomatically(boolean enablesReturnKeyAutomatically)
Sets a Boolean that defines whether the return key is automatically
enabled.
|
void |
setFont(UIFont font)
Sets the font of this text field.
|
void |
setKeyboardAppearance(int UIKeyboardAppearance)
Sets appearance type of the keyboard used along with the text field.
|
void |
setKeyboardType(int UIKeyboardType)
Sets the style of the keyboard that will be used along with the text
field.
|
void |
setPlaceholder(String placeholder)
Sets the text to be displayed when there is no text inserted in this text
field.
|
void |
setReturnKeyType(int UIReturnKeyType)
Sets the type of the return key.
|
void |
setSecureTextEntry(boolean secureTextEntry)
Sets a Boolean that defines if the text that is being entered in the text
field should be hidden.
|
void |
setText(String text)
Sets the text to be displayed on this text field.
|
void |
setTextAlignment(int UITextAlignment)
Set the text alignment for this text field.
|
void |
setTextColor(UIColor color)
Sets the text color for this text field.
|
void |
setTextContentType(String textContentType)
Sets the type of text expected in the text input area
|
String |
text()
Returns the text that is displayed on this text field.
|
int |
textAlignment()
Returns the text alignment of this text field.
|
UIColor |
textColor()
Returns the text color of this text field.
|
String |
textContentType()
The type of text expected in the text input area
|
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, 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, windowisFirstResponderaddObserver, observeValueForKeyPath, performSelector, performSelectorOnMainThread, release, removeObserver, removeObserver, retain, setValueForKey, setValueForUndefinedKey, valueForKey, valueForUndefinedKeyequals, getClass, hashCode, notify, notifyAll, wait, wait, waitsetSmartDashesType, setSmartInsertDeleteType, setSmartQuotesType, setSpellCheckingType, smartDashesType, smartInsertDeleteType, smartQuotesType, spellCheckingTypepublic UITextField()
public UITextField(CGRect rect)
rect - describes the location and size of UITextFieldpublic int autocapitalizationType()
UITextInputTraitsautocapitalizationType in interface UITextInputTraitspublic void setAutocapitalizationType(int UITextAutocapitalizationType)
UITextInputTraitssetAutocapitalizationType in interface UITextInputTraitsUITextAutocapitalizationType - The auto-capitalization style for the
content of the text field.UITextAutocapitalizationTypepublic int autocorrectionType()
UITextInputTraitsautocorrectionType in interface UITextInputTraitspublic void setAutocorrectionType(int UITextAutocorrectionType)
UITextInputTraitssetAutocorrectionType in interface UITextInputTraitsUITextAutocorrectionType - The type of auto-correction for the
content of this text field.UITextAutocorrectionTypepublic boolean enablesReturnKeyAutomatically()
UITextInputTraitsenablesReturnKeyAutomatically in interface UITextInputTraitspublic void setEnablesReturnKeyAutomatically(boolean enablesReturnKeyAutomatically)
UITextInputTraitssetEnablesReturnKeyAutomatically in interface UITextInputTraitsenablesReturnKeyAutomatically - A Boolean that defines whether the
return key is automatically enabled.public int keyboardAppearance()
UITextInputTraitskeyboardAppearance in interface UITextInputTraitsUIKeyboardAppearancepublic void setKeyboardAppearance(int UIKeyboardAppearance)
UITextInputTraitssetKeyboardAppearance in interface UITextInputTraitsUIKeyboardAppearance - The appearance type of the keyboard used
along with the text field.UIKeyboardAppearancepublic int keyboardType()
UITextInputTraitskeyboardType in interface UITextInputTraitspublic void setKeyboardType(int UIKeyboardType)
UITextInputTraitssetKeyboardType in interface UITextInputTraitsUIKeyboardType - The style of keyboard that will be used along with
the text field.UIKeyboardTypepublic int returnKeyType()
UITextInputTraitsreturnKeyType in interface UITextInputTraitsUIReturnKeyTypepublic void setReturnKeyType(int UIReturnKeyType)
UITextInputTraitssetReturnKeyType in interface UITextInputTraitsUIReturnKeyType - The type of the return key.UIReturnKeyTypepublic boolean isSecureTextEntry()
UITextInputTraitsisSecureTextEntry in interface UITextInputTraitspublic void setSecureTextEntry(boolean secureTextEntry)
UITextInputTraitssetSecureTextEntry in interface UITextInputTraitssecureTextEntry - A Boolean that defines if the text that is being
entered in the text field should be hidden.public String textContentType()
UITextInputTraitstextContentType in interface UITextInputTraitspublic void setTextContentType(String textContentType)
UITextInputTraitssetTextContentType in interface UITextInputTraitstextContentType - The type of text expected in the text input areapublic String text()
public void setText(String text)
text - The text to be displayed on this text field.public UIColor textColor()
public void setTextColor(UIColor color)
color - The text color for this text field.public int borderStyle()
UITextBorderStylepublic void setBorderStyle(int UITextBorderStyle)
UITextBorderStyle - The border style for this text field.UITextBorderStylepublic UIFont font()
public void setFont(UIFont font)
font - The font of this text field.public boolean adjustsFontSizeToFitWidth()
public void setAdjustsFontSizeToFitWidth(boolean adjustsFontSizeToFitWidth)
adjustsFontSizeToFitWidth - A Boolean that defines whether the font
size should adjust to fit the size of this text field.public int textAlignment()
UITextAlignmentpublic void setTextAlignment(int UITextAlignment)
UITextAlignment - The text alignment for this text field.UITextAlignmentpublic void setPlaceholder(String placeholder)
placeholder - The text to be displayed when there is no text
inserted in this text field.public String placeholder()
public void setDelegate(UITextFieldDelegate delegate)
delegate - The delegate for this text field.public void setBackgroundColor(UIColor background)
UIViewsetBackgroundColor in class UIViewbackground - The view’s background color.public UITextFieldDelegate delegate()
public boolean resignFirstResponder()
UIResponderresignFirstResponder in class UIResponderpublic boolean becomeFirstResponder()
UIResponderbecomeFirstResponder in class UIResponderpublic 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.Copyright © 2020. All rights reserved.