开发者

UITextView and NSUndoManager synchronisation

I have tried to search first but couldn't find exactly what I need.

I have one UITextView and I have buttons that are executing actions undo and redo on UITextViews NSUndoManager so that part is working but here comes the problem. Undo actions are undoing all changes that I create after text view becomes first responder, so to be able to have detailed undo or redo actions that are undoing or redoing only the last action and not all actions performed from the moment where UITextView become first responder I should have code like this:

- (void)textViewDidChange:(UITextView *)textView
{
    [textView resignFirstResponder];
    [textView becomeFirstResponder];
}

But this code is not a solution, it works but I would like to synchronize actions performed in UITextView in the same way like the code above but without resigning UITextView as开发者_如何学C the first responder.

Tnx for help.


If im not wrong, each undo/redo action is grouped by an event loop. If yo do many thing within the same event loop, all those things form the same action.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜