iOS 6已更新爲使用UITextView進行富文本編輯(UITextView現在獲得了一個屬性文本屬性 - 這是愚蠢的不可變的)。這裏是一個問題在iOS 6蘋果論壇下的NDA問題,可以公開,因爲iOS 6現在是公開的...UITextView撤消管理器不能使用替換屬性字符串(iOS 6)
在UITextView中,我可以撤消任何字體更改,但不能撤消副本中的替換視圖的歸因字符串。使用此代碼時...
- (void) replace: (NSAttributedString*) old with: (NSAttributedString*) new
{
1. [[myView.undoManager prepareWithInvocationTarget:self] replace:new with:old];
2. old=new;
}
...撤銷運行良好。
但是,如果我添加一行來得到我的觀點的結果可見,在UndoManager的不火的「替代:用」方法,因爲它應該...
- (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」...
謝謝。但問題是這個協議不能代替一個歸屬串,只有一個NSString。 – Denis