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, state
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, 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, window
isFirstResponder
addObserver, observeValueForKeyPath, performSelector, performSelectorOnMainThread, release, removeObserver, removeObserver, retain, setValueForKey, setValueForUndefinedKey, valueForKey, valueForUndefinedKey
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
setSmartDashesType, setSmartInsertDeleteType, setSmartQuotesType, setSpellCheckingType, smartDashesType, smartInsertDeleteType, smartQuotesType, spellCheckingType
public UITextField()
public UITextField(CGRect rect)
rect
- describes the location and size of UITextFieldpublic int autocapitalizationType()
UITextInputTraits
autocapitalizationType
in interface UITextInputTraits
public void setAutocapitalizationType(int UITextAutocapitalizationType)
UITextInputTraits
setAutocapitalizationType
in interface UITextInputTraits
UITextAutocapitalizationType
- The auto-capitalization style for the
content of the text field.UITextAutocapitalizationType
public int autocorrectionType()
UITextInputTraits
autocorrectionType
in interface UITextInputTraits
public void setAutocorrectionType(int UITextAutocorrectionType)
UITextInputTraits
setAutocorrectionType
in interface UITextInputTraits
UITextAutocorrectionType
- The type of auto-correction for the
content of this text field.UITextAutocorrectionType
public boolean enablesReturnKeyAutomatically()
UITextInputTraits
enablesReturnKeyAutomatically
in interface UITextInputTraits
public void setEnablesReturnKeyAutomatically(boolean enablesReturnKeyAutomatically)
UITextInputTraits
setEnablesReturnKeyAutomatically
in interface UITextInputTraits
enablesReturnKeyAutomatically
- A Boolean that defines whether the
return key is automatically enabled.public int keyboardAppearance()
UITextInputTraits
keyboardAppearance
in interface UITextInputTraits
UIKeyboardAppearance
public void setKeyboardAppearance(int UIKeyboardAppearance)
UITextInputTraits
setKeyboardAppearance
in interface UITextInputTraits
UIKeyboardAppearance
- The appearance type of the keyboard used
along with the text field.UIKeyboardAppearance
public int keyboardType()
UITextInputTraits
keyboardType
in interface UITextInputTraits
public void setKeyboardType(int UIKeyboardType)
UITextInputTraits
setKeyboardType
in interface UITextInputTraits
UIKeyboardType
- The style of keyboard that will be used along with
the text field.UIKeyboardType
public int returnKeyType()
UITextInputTraits
returnKeyType
in interface UITextInputTraits
UIReturnKeyType
public void setReturnKeyType(int UIReturnKeyType)
UITextInputTraits
setReturnKeyType
in interface UITextInputTraits
UIReturnKeyType
- The type of the return key.UIReturnKeyType
public boolean isSecureTextEntry()
UITextInputTraits
isSecureTextEntry
in interface UITextInputTraits
public void setSecureTextEntry(boolean secureTextEntry)
UITextInputTraits
setSecureTextEntry
in interface UITextInputTraits
secureTextEntry
- A Boolean that defines if the text that is being
entered in the text field should be hidden.public String textContentType()
UITextInputTraits
textContentType
in interface UITextInputTraits
public void setTextContentType(String textContentType)
UITextInputTraits
setTextContentType
in interface UITextInputTraits
textContentType
- 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()
UITextBorderStyle
public void setBorderStyle(int UITextBorderStyle)
UITextBorderStyle
- The border style for this text field.UITextBorderStyle
public 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()
UITextAlignment
public void setTextAlignment(int UITextAlignment)
UITextAlignment
- The text alignment for this text field.UITextAlignment
public 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)
UIView
setBackgroundColor
in class UIView
background
- The view’s background color.public UITextFieldDelegate delegate()
public boolean resignFirstResponder()
UIResponder
resignFirstResponder
in class UIResponder
public boolean becomeFirstResponder()
UIResponder
becomeFirstResponder
in class UIResponder
public void touchesBegan(Set<UITouch> touches, UIEvent event)
UIResponder
touchesBegan
in class UIControl
touches
- 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)
UIResponder
touchesMoved
in class UIControl
touches
- 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)
UIResponder
touchesEnded
in class UIControl
touches
- 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)
UIResponder
touchesCancelled
in class UIControl
touches
- The set touches to which the touch belongs.event
- The event to which the touches belong.Copyright © 2020. All rights reserved.