PDA

View Full Version : manually setTitle?




Darkroom
Jun 25, 2008, 12:35 AM
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:


- (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...



Catfish_Man
Jun 25, 2008, 12:58 AM
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];

Darkroom
Jun 25, 2008, 01:17 AM
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];

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


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