ios开发之--textview意见反馈页面(占位label,字数统计,提交按钮的交 ...

ios开发之--textview意见反馈页面(占位label,字数统计,提交按钮的交 ...

2023年7月14日发(作者:)

ios开发之--textview意见反馈页⾯(占位label,字数统计,提交按钮的交互设置)...记录⼀个页⾯的功能:textview的占位符,字数统计,提交按钮的交互设置,具体效果图如下:输⼊效果:具体实现代码如下:1,设置代理@interface FKViewController ()2,我是直接xib拖拽的控件@property (weak, nonatomic) IBOutlet UITextView *FKTextView;@property (weak, nonatomic) IBOutlet UILabel *descLab;@property (weak, nonatomic) IBOutlet UIButton *sendBtn;@property (weak, nonatomic) IBOutlet UILabel *stringlenghtLab;3,viewDidLoad⾥⾯te = self; teractionEnabled = NO; teractionEnabled = NO; oundColor = [UIColor lightGrayColor];4,具体代理⽅法实现-(void)textViewDidChange:(UITextView *)textView{ = YES; teractionEnabled = YES; oundColor = MainColor; //实时显⽰字数 = [NSString stringWithFormat:@"%ld/100",(long)];

//字数限制 if ( >= 100) { = [ substringToIndex:100]; }

//取消按钮点击权限,并显⽰⽂字 if ( == 0) { = NO; teractionEnabled = NO; oundColor = [UIColor lightGrayColor]; }}-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{ if ([text isEqualToString:@"n"]) {

[View resignFirstResponder];

return NO; }

return YES;}仅做记录!

发布者:admin,转转请注明出处:http://www.yc00.com/web/1689264833a226440.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信