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);

    }

     
  • 相关阅读:
    用js实现一个简单的mvvm
    ~~~持续更新,面向对象的编程,个人浅见
    前端直播功能开发总结
    echarts饼图去除鼠标移入高亮
    外包项目的感悟
    white-space:pre-wrap和word-break:break-all;
    转行两年,工作一年年,谈谈浅见
    html2canvas
    js点滴
    常用工具链接
  • 原文地址:https://www.cnblogs.com/PSSSCode/p/5272030.html
Copyright © 2011-2022 走看看