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

    }

     
  • 相关阅读:
    javascript中map的用法
    洛谷P1057传球游戏-题解
    洛谷P1049装箱问题-题解
    洛谷P1048采药-题解
    洛谷P1044栈-题解
    洛谷P1040加分二叉树-题解
    洛谷P1005矩阵取数游戏-题解
    洛谷P1004方格取数-题解
    洛谷P1002过河卒-题解
    搜索
  • 原文地址:https://www.cnblogs.com/PSSSCode/p/5272030.html
Copyright © 2011-2022 走看看