Record the function of a page:
TextView placeholder, Word count, submit button interactive settings, as follows:
Input effect:
The specific implementation code is as follows:
1, setting up the proxy
@interface Fkviewcontroller () <UITextViewDelegate>
2, I am the direct xib drag control
@property (Weak, nonatomic) iboutlet Uitextview ***stringlenghtlab;
3,viewdidload inside
Self. Fktextview. delegate = self ; = NO; = NO; = [Uicolor Lightgraycolor];
4, the specific agent method to achieve
-(void) Textviewdidchange: (Uitextview *) textview{Self.descLab.hidden=YES; Self.sendBtn.userInteractionEnabled=YES; Self.sendBtn.backgroundColor=Maincolor; //real-time display of wordsSelf.stringlenghtLab.text = [NSString stringWithFormat:@"%ld/100",(Long) TextView.text.length]; //Word Limit if(TextView.text.length >= -) {Textview.text= [Textview.text Substringtoindex: -]; } //Cancel the button click Permission and display the text if(TextView.text.length = =0) {Self.descLab.hidden=NO; Self.sendBtn.userInteractionEnabled=NO; Self.sendBtn.backgroundColor=[Uicolor Lightgraycolor]; }}-(BOOL) TextView: (Uitextview *) TextView Shouldchangetextinrange: (nsrange) Range Replacementtext: (NSString *) text{if([Text isequaltostring:@"\ n"]) {[Self. Fktextview Resignfirstresponder]; returnNO; } returnYES;}
Just make a record!
iOS Development--textview Feedback page (placeholder label, word count, interactive settings for submit button)