UITextView上的清除按钮 [英] Clear button on UITextView

查看:1879
本文介绍了UITextView上的清除按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在文本字段中为文本视图添加一个清除按钮(在圆圈内交叉)?

How can add a clear button (cross inside a circle) for text view like in text field?

推荐答案

一个uibutton并将其放在uitextview上并设置其动作以获得明文视图;

just make a uibutton and put it on uitextview and set its action for clear text view;

uitextview.frame = (0,0,320,416);

uibutton.frame = (310,0,10,10);
[uibutton setimage:@"cross.png" forcontrolstate:uicontrolstatenoraml];
[uibutton addTarget:self action:@selector(clearButtonSelected:) forControlEvents:UIControlEventTouchUpInside];

-(void)clearButtonSelected{
    uitextview=@"";
}

希望您在点击上方的十字按钮时清除文本视图文本是帮助
如果不明白那么我可以给你发送适当的程序

hope you want to clear the text view text when you click on cross button above is help if not understand then i can send you proper program for that

这篇关于UITextView上的清除按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆