撤消|菜单项栏上的“重做”命令显示为灰色。
我正在通过培训练习来学习Xcode。培训师指示每个人将Window的Outlets委托设置为appDelegate,这将提供使undo | redo命令起作用的功能。无法正常工作。
//function in my appDelegate and ViewController
func windowWillReturnUndoManager(_ window: NSWindow) -> UndoManager? {
// Returns the NSUndoManager for the application. In this case, the manager returned is that of the managed object context for the application.
NSLog("NSundo manager is up and running") //for visual signs
return persistentContainer.viewContext.undoManager
我还确保我的AppDelegate.swift文件遵守NSWindowDelegate
class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
我希望对数据进行更改时,菜单项栏上的撤消和重做功能会突出显示。没有发生。您可以提供的任何帮助都会非常好。谢谢