1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

manually setTitle?

Discussion in 'Mac Programming' started by Darkroom, Jun 24, 2008.

  1. Guest

    Darkroom

    #1
    i know i can set the a window's title in interface builder, but i would still like to know how to do things manually, like setting a window's title. the following code doesn't work:

    Code:
    - (void)setTitle:(NSString *)title
    	{
    	title = @"Window's New Title";
    	}
    
    this code is overriding IB's set title, so i know it's in the right place, but the override is just displaying a blank title bar...
     
  2. macrumors 68030

    Catfish_Man

    #2
    You shouldn't access instance variables of Cocoa classes directly, as they're generally not guaranteed to remain the same across OS versions (and in fact may not be public on all OS versions); instead I'd try something like [super setTitle:title];
     
  3. Guest

    Darkroom

    #3
    ok i understand... and it worked great... thanks!

    Code:
    - (void)setTitle:(NSString *)title
    	{
    	title = @"Window's New Title";
    	[super setTitle:title];
    	}
    
    
     

Share This Page