iOS 6 has been updated to use UITextView to edit rich text (UITextView now gets the attributedText property, which doesn’t stupidly change). Here is the question asked on the Apple iOS 6 forum under the NDA, which can be made public, since iOS 6 is now publicly ...
In UITextView, I can undo any font change, but I cannot undo the replacement in the copy of the string associated with the view. When using this code ...
- (void) replace: (NSAttributedString*) old with: (NSAttributedString*) new
{
1. [[myView.undoManager prepareWithInvocationTarget:self] replace:new with:old];
2. old=new;
}
... destruction works well.
But if I add a line to get the result visible in my view, undoManager does not run the "replace: with:" method, as it should ...
- (void) replace: (NSAttributedString*) old with: (NSAttributedString*) new
{
1. [[myView.undoManager prepareWithInvocationTarget:self] replace:new with:old];
2. old=new;
3. myView.attributedText=[[NSAttributedString alloc] initWithAttributedString:old];
}
? , , MutableAttributedString, "2"...