ios - Replace text in UITextView run slowly -
I have a UITextView and I change a word like the code at the end of UITextView.text:
- (void) Replace TexttechWitWord: (NSString *) word {NSString * currentTextViewText = self.textView.text; CurrentTextViewText = [currentTextViewText stringByReplacingCharactersInRange: NSMakeRange ([self.textView.text length] - [word length], [word length]) withString: word; Self.textView.text = currentTextViewText; } Replacement work is fine, but it runs very slowly and very slowly when the textView now lengthens
Is there any better way?
I try the replacement range: with text for a week but still stuck. Not to know how to use it to replace it in your case. Please guide! Thanks in advance! This is an important job.
As you are using an irreversible string and you are creating a very long string and before Assigned to NSString created from.
NSString will be used instead of NSMutableString . - (UITableViewCell *) TableView: (UITableView *) Table View CellForOutPath: (NSIndexPath *) IndexPath {FooBarCell * cell = [TableView DQURUbelCalView Identifier: KCIL Identifier]; If (cell == zero) {cell = [[edit cell alloc] initWithStyle: UITableViewCellStyleSubtitle reuseIdentifier: kCellIdentifier]; Cell.mutableString = [NSMutableString string]; Cell.textView.text = cell.mutableString; } [Cell.mutableString setString: @ "Text to show"]; Return cell; }
Comments
Post a Comment