I have a UITextView with combination of text and custom smileys (Attached using NSTextAttachment). And I have a custom UIButton action in which I need to clear the single character from textview's text. My questions are below.
I tried a lot, but couldn't get it. Any ideas please..
Thanks
isKindOfClass
method. This will tell you whether the object is of class NSTextAttachment
or NSString
. NSMutableAttributedString
, if so then just find out the range of the character and delete it using deleteCharactersInRange:
method of NSMutableAttributedString
. Try this:
-(IBAction)yourButton:(id)sender {
yourUITextView.text = [NSString stringWithFormat:@" Your text here, omit the smiley."];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.