On 26 May 2012, at 23:03, Quincey Morris wrote:

> On May 25, 2012, at 23:26 , Gerriet M. Denkmann wrote:
> 
>> But when the app restarts, it does:
>> 
>> - (void)restoreStateWithCoder:(NSCoder *)coder
>> {
>>      [ super restoreStateWithCoder: coder ];
>>      NSString *s = [ coder decodeObjectForKey: @"DisplayName" ];
>>      [ self setDisplayName: s ];
>> }
>> 
>> Now this display name is never seen. The window just shows "Untitled".
>> 
>> It seems that setDisplayName: only works when the document does not yet have 
>> a window.
>> But restoreStateWithCoder: is called after windowControllerDidLoadNib:.
>> 
>> What is do be done?
> 
> One answer, I guess, is simply to call 'setTitle:' on the window, if it 
> already exists.

Yes. Did that. Works great.

I was reluctant to do so, because I thought that the window title was somehow 
managed by the DocumentController and that setting it directly would mess 
things up.

But so far I have not seen any adverse side-effects.

Thanks for the tip.

Gerriet.


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to