Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear button on UITextView

How can I add a clear button (cross inside a circle) for UITextView like UITextField has?

like image 950
Abhinav Avatar asked Oct 07 '10 00:10

Abhinav


1 Answers

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

like image 110
GhostRider Avatar answered Sep 28 '22 13:09

GhostRider