• 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
Re: string help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: string help
      • From: Chris Hanson <email@hidden>
References: 
 >string help (From: Bob Sabiston <email@hidden>)
 >Re: string help (From: Chris Hanson <email@hidden>)

  • Prev by Date: Re: Tracking Rect problem.
  • Next by Date: Re: NSValidationNumberTooSmallError with incomplete error message
  • Previous by thread: Re: string help
  • Next by thread: Re: string help
  • Index(es):
    • Date
    • Thread