Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
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...
 

Catfish_Man

macrumors 68030
Sep 13, 2001
2,579
2
Portland, OR
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

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
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!

Code:
- (void)setTitle:(NSString *)title
	{
	title = @"Window's New Title";
	[super setTitle:title];
	}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.