Re: string help
Re: string help
- Subject: Re: string help
- From: Bob Sabiston <email@hidden>
- Date: Thu, 8 Sep 2005 10:06:32 -0500
On Sep 7, 2005, at 7:15 PM, Chris Hanson wrote:
On Sep 7, 2005, at 3:55 PM, Bob Sabiston wrote:
Within my Controller object, I have commandString defined like this:
Where and how do you allocate commandString?
-- Chris
Well, I just set it to this value @"nocommand" in my Controller init
function. How should I allocate it instead?
- (id)init {
self = [super init];
// initialize NSApplication, using an entry point that is
specific to bundles
// this will be a no-op for Cocoa apps loading this bundle, but
is required by Carbon apps
// this is not the final API
NSApplicationLoad();
if (![NSBundle loadNibNamed:@"RunThreadViewer" owner:self]) {
NSLog(@"failed to load RunThreadViewer nib");
}
commandString = @"nocommand";
sharedController = self;
return self;
}
Actually, I just tried
commandString = [NSMutableString initWithCapacity:255];
That keeps it from crashing, but if I follow that with
[commandString setString:@"no command set"];
or if I use this function:
- (void)setCommandString:(NSString *)text {
if (text)
[commandString setString:text];
else [commandString setString:@"unknown"];
}
then it does not seem to do anything. I am still foggy on how the
string allocation works.
Thanks for any tips,
Bob
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden