iOS Development Note TextView

Source: Internet
Author: User

1. Cannot scroll

self.scrollenabled = NO;

2. Normal font

[Uifont systemfontofsize:30.0f]

3. Bold font

[Uifont boldsystemfontofsize:30.0f]

4. Text Box offset

Self.textcontainerinset = Uiedgeinsetsmake (Textview_top_inset, Textview_left_inset, TEXTVIEW_BOTTOM_INSET,TEXTVIEW _right_inset);

5. Get Input status

[Self becomefirstresponder];

6. Is it possible to edit

[Self seteditable:yes];

7. Limit the input length

According to this idea, the text length to be generated = Original text length-select text length + Enter text length. Considering the deletion situation, my code is as follows:-(BOOL) TextView: (Uitextview *) TextView Shouldchangetextinrange: (nsrange) range Replacementtext: ( NSString *) text{    if ([Text isequaltostring:@ ""] && range.length > 0) {        //delete character must be safe        return yes;< c3/>}    else {        if (textview.text.length-range.length + text.length > Max_input_length) {            Uialertview * alert = [[Uialertview alloc] initwithtitle:@ "exceeds maximum input length" Message:nil delegate:self cancelbuttontitle:@ "OK" Otherbuttontitles:nil];            [Alert show];            return NO;        }        else {            return YES;}}    }

8. Cannot select

[Self setselectable:yes];


iOS Development Note TextView

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.