开发者

Changing file extension for a 'save as' in NSDocument?

I want to give my app, which currently simply saves out folders, the option of giving these folders file extensions (for saving packages).

At the moment, when I do 'saveDocumentAs:', I get the save sheet with 'Untitled' as the suggested filename, how can I optionaly make it say (for e开发者_如何学Cxample) 'Untitled.myext'?

Cheers

MT


NSDocument is supposed to require whatever file extension is configured for your document in your Info.plist. Is it possible the "Hide extension" checkbox is checked?

If you want to force the extension to be shown, it's a persisted preference, so you'd have to do it like:

[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:NO] forKey:@"NSNavLastUserSetHideExtensionButtonState"];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜