Restoring from versions browser on OSX lion not working… ideas?

人走茶凉 提交于 2019-12-02 11:10:42

I had a similar problem recently (my interface didn't seem to update). Are you updating your interface in windowControllerDidLoadNib: or awakeFromNib ? When a document is reverted (revert to last saved, or selecting a version in the versions browser), windowControllerDidLoadNib: is not called again because the document is already loaded, but your file wrapper method will be.

I'm not sure if this is the best solution, but what I do is update the UI in the read wrapper method only if the document is being reverted. I do this by checking if an outlet (like your textview) is not nil.

Update:

A better solution is overriding -revertToContentsOfURL:ofType:error:

- (BOOL)revertToContentsOfURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError * __autoreleasing *)outError
{
    BOOL reverted = [super revertToContentsOfURL:absoluteURL ofType:typeName error:outError];
    if (reverted)
    {
        // re-update interface
    }
    return reverted;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!