zoukankan      html  css  js  c++  java
  • iOS

    1、UITextView

       //因为继承于UIScrollView 拥有scrollView的所有属性和方法

        //placeholder只有UITextField有,UITextView是没有的。(提示文字)

        //多行文本框

        UITextView * textView = [[UITextView alloc] initWithFrame:CGRectMake(20, 40, self.view.bounds.size.width - 40, 100)];

        //设置输入文字

        textView.text = @"解放了肯定;

        //设置字体

        textView.font = [UIFont systemFontOfSize:25];

        //设置颜色

        textView.textColor = [UIColor redColor];

        //设置对齐方式

        textView.textAlignment = NSTextAlignmentLeft;

        //是否允许编辑

        textView.editable = YES;

        //设置代理方法

        textView.delegate = self;

        //inputView(自定义键盘) 可以只设置高度,键盘默认高度216.

    2、UITextView 代理

    //是否允许开始编辑方法

    - (BOOL)textViewShouldBeginEditing:(UITextView *)textView {}

    //是否允许结束编辑方法

    - (BOOL)textViewShouldEndEditing:(UITextView *)textView {}

    //已经开始编辑

    - (void)textViewDidBeginEditing:(UITextView *)textView {}

    //已经结束编辑

    - (void)textViewDidEndEditing:(UITextView *)textView {}

    //是否允许文本框文字改变

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

    //监测文本变化

    - (void)textViewDidChange:(UITextView *)textView {    

        NSLog(@"%@",textView.text);

    }

     
  • 相关阅读:
    linux --- 3 vim 网络 用户 权限 软连接 压缩 定时任务 yum源
    linux --- 2.常用命令 , python3, django安装
    linux --- 1.初始linux
    admin ---11.admin , 展示列表 和 分页
    并发 ---- 6. IO 多路复用
    django基础 -- 10.form , ModelForm ,modelformset
    django基础 -- 9.中间件
    flask基础
    MySQL-数据库增删改查
    面试题目二
  • 原文地址:https://www.cnblogs.com/PSSSCode/p/5272030.html
Copyright © 2011-2022 走看看