• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Window setTitle Ignored at Launch?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Window setTitle Ignored at Launch?


  • Subject: Window setTitle Ignored at Launch?
  • From: Chunk 1978 <email@hidden>
  • Date: Fri, 6 Nov 2009 12:01:16 -0500

i'm following hillegass' "view swapping" (chapter 29), concerning the
NSViewController.  i can successfully display the proper view at launch
(based on the index of an NSMutableArray), but i cannot set the window's
title using the same index?  the window loads as "Untitled", which is it's
title in IB.  the window's title only changes when the user chooses a new
view from the popup menu.  what am i doing wrong?

- (void)displayViewController:(ManagingViewController *)vc

{

//Try to end editing

NSWindow *w = [box window];

BOOL ended = [w makeFirstResponder:w];

 if (!ended)

{

NSBeep();

return;

}

 //Put the view in the box

NSView *v = [vc view];

[box setContentView:v];


//-=-=-=-=-=-=-=-=-=-=-=-//

// CHANGE WINDOW'S TITLE //

//-=-=-=-=-=-=-=-=-=-=-=-//


 [w setTitle:[NSString stringWithFormat:@"Application Mode: %@", [vc title
]]];

}

 - (NSString *)windowNibName

{

return @"MyDocument";

}


- (void)windowControllerDidLoadNib:(NSWindowController *)windowController

{

[super windowControllerDidLoadNib:windowController];

NSMenu *menu = [popUp menu];

int i, itemCount;

itemCount = [viewControllers count];

 for (i = 0 ; i < itemCount ; i++)

{

NSViewController *vc = [viewControllers objectAtIndex:i];

NSMenuItem *mi = [[NSMenuItem alloc] initWithTitle:[vc title] action:
@selector(changeViewController:) keyEquivalent:@""];

[mi setTag:i];

[menu addItem:mi];

[mi release];

}

 [self displayViewController:[viewControllers objectAtIndex:0]];

[popUp selectItemAtIndex:0];

}
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Window setTitle Ignored at Launch?
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Core-Data : how to merge two contexts ?
  • Next by Date: Re: NSString's handling of Unicode extension B (and C) characters
  • Previous by thread: Re: Core-Data : how to merge two contexts ?
  • Next by thread: Re: Window setTitle Ignored at Launch?
  • Index(es):
    • Date
    • Thread