UITextFiled

UITextField是常用的文本输入控件,用于用户输入文本信息(类似于c中的scanf)的UI视图

  UITextFieldUIlabel的区别:UIlabel可以在界面中显示文本,但是无法选择或编辑UIlabel上的文本,如果用户想输入文本,就可以使用UITextField控件。

<一>.基础属性方法

【见UITextFieldDemo1-基础语法】

//下面列出属性方法的在工程中相关函数

Accessing the Text Attributes

- (void)textFieldSetting

  •    text  property

  •    placeholder  property

  •    font  property

  •    textColor  property

  •    textAlignment  property

Sizing the Text Field’s Text

- (void)textFieldSetting

  •    adjustsFontSizeToFitWidth  property

  •    minimumFontSize  property

Managing the Editing Behavior

- (void)textFieldSetting

  •    editing  property

  •    clearsOnBeginEditing  property

Setting the View’s Background Appearance

- (void)textFieldSetting

  •    borderStyle  property

  •    background  property

  •    disabledBackground  property

Managing Overlay Views

- (void)textFieldSetting

  •    clearButtonMode  property

  •    leftView  property

  •    leftViewMode  property

  •    rightView  property

  •    rightViewMode  property

Replacing the System Input Views

- (void)keyboardSetting

  •    inputView  property

  •    inputAccessoryView  property


<二>.重写方法

【注】以下方法无法设置,调用无效,是提供给继承这个UITextField类后,重写的方法


Drawing and Positioning Overrides

  • – textRectForBounds:

  • – drawTextInRect:

  • – placeholderRectForBounds:

  • – drawPlaceholderInRect:

  • – borderRectForBounds:

  • – editingRectForBounds:

  • – clearButtonRectForBounds:

  • – leftViewRectForBounds:

  • – rightViewRectForBounds:



<三>.代理方法 UITextFieldDelegate

Accessing the Delegate

  •    delegate  property


Managing Editing

  • – textFieldShouldBeginEditing:

  • – textFieldDidBeginEditing:

  • – textFieldShouldEndEditing:

  • – textFieldDidEndEditing:

Editing the Text Field’s Text

  • – textField:shouldChangeCharactersInRange:replacementString:

  • – textFieldShouldClear:

  • – textFieldShouldReturn:



你可能感兴趣的:(UITextFiled)