zoukankan      html  css  js  c++  java
  • UITextField 和 UITextView

    UITextField

    属性:

    1、frame 坐标

    2、borderStyle 边框样式

    3、placeholder 提示文字

    4、keyboardType 键盘样式(数字键盘,字母键盘等)

    5、keyboardAppearance 键盘外观

    6、secureTextEntry 密文输入

    7、clearButtonMode 清除按钮模式

    8、inputView 弹出视图(自定义view之类的)

    9、leftView 左侧视图(还需要设置左视图模式)

    10、leftViewMode 左侧视图模式

    11、rightView 右侧视图

    12、rightViewMode 右侧视图模式

    13、clearsOnBeginEditing 再次编辑是否清空

    14、contentVerticalAlignment 内容纵向对齐方式

    15、contentHorizontalAlignment 内容横向对齐方式

    16、textAlignment 文本横向对齐方式

    17、adjustsFontSizeToFitWidth 文本滚动

    18、minimumFontSize 最小字号

    19、autocapitalizationType 首字母是否大写

    20、returnKeyType return键样式

    1、键盘样式(数字键盘,字母键盘):

    (1)UIKeyboardTypeDefault, // 默认键盘:支持所有字符   

    (2)UIKeyboardTypeASCIICapable, // 支持ASCII的默认键盘   

    (3)UIKeyboardTypeNumbersAndPunctuation, // 标准电话键盘,支持+*#等符号   

    (4)UIKeyboardTypeURL, // URL键盘,有.com按钮;只支持URL字符   

    (5)UIKeyboardTypeNumberPad,           //数字键盘   

    (6)UIKeyboardTypePhonePad,           // 电话键盘   

    (7)UIKeyboardTypeNamePhonePad, // 电话键盘,也支持输入人名字   

    (8)UIKeyboardTypeEmailAddress, // 用于输入电子邮件地址的键盘   

    2、键盘外观

    (1) UIKeyboardAppearanceDefault/UIKeyboardAppearanceLight // 默认外观:浅灰色 ,近白色

    (2)UIKeyboardAppearanceAlert/UIKeyboardAppearanceDark       //深灰/石墨色

    方法:

    (以下几种方法都是需先声明协议<UITextFieldDelegate>,然后复写以下方法)

    1、//文本输入框是否进入编辑模式

    - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField;

    2、//文本输入框已经进入编辑模式

    - (void)textFieldDidBeginEditing:(UITextField *)textField;

    3、//文本输入框是否可以结束编辑模式

    - (BOOL)textFieldShouldEndEditing:(UITextField *)textField;

    4、//文本输入框已经结束编辑模式

    - (void)textFieldDidEndEditing:(UITextField *)textField;

    5、//文本输入框是否可以点击Clear按钮

    - (BOOL)textFieldShouldClear:(UITextField *)textField;

    6、//文本输入框是否可以点击Return按钮

    - (BOOL)textFieldShouldReturn:(UITextField *)textField

    UITextView

    是文本视图空间,继承自UIScrollView,用于显示或者输入一行或多行文字 

    属性:

    1、text 文字内容

    2、textColor 文字颜色

    3、textAlignment 文字对齐方式

    4、selectedRange 控制滚动

    5、editable 是否可编辑

    方法:

    1、

    - (void)scrollRangeToVisible:(NSRange)range;

    2、

    - (BOOL)textViewShouldBeginEditing:(UITextView *)textView;

    3、

    - (BOOL)textViewShouldEndEditing:(UITextView *)textView;

    4、

    - (void)textViewDidBeginEditing:(UITextView *)textView;

    5、

    - (void)textViewDidEndEditing:(UITextView *)textView;

    6、

    //是否可以修改textView

    -(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text;

    7、

    //改变了textView内容

    -(void)textViewDIdChange:(UITextView *)textView;

    8、

    //开始编辑(包括select all等方法)或修改

    - (void)textViewDidChangeSelection:(UITextView *)textView;

    自动到textview地步:

    NSUInteger length = textView.text.length;

    textView.selectedRange = NSMaxRange(length,0);

  • 相关阅读:
    安全检测点的一些梳理——待长期整理
    Tor真的匿名和安全吗?——如果是http数据,则在出口节点容易被嗅探明文流量,这就是根本问题
    prefixspan是挖掘频繁子序列,子序列不一定是连续的,当心!!!
    spark mllib prefixspan demo
    spark 2.4 java8 hello world
    有效的括号序列——算法面试刷题4(for google),考察stack
    相似的RGB颜色——算法面试刷题3(for google),考察二分
    回文的范围——算法面试刷题2(for google),考察前缀和
    最长绝对文件路径——算法面试刷题1(google),字符串处理,使用tree遍历dfs类似思路
    比较全面的gdb调试命令
  • 原文地址:https://www.cnblogs.com/durwards/p/4525105.html
Copyright © 2011-2022 走看看