• 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
wasting space?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wasting space?


  • Subject: wasting space?
  • From: Thomas Schönfeld <email@hidden>
  • Date: Sun, 05 Oct 2008 01:39:21 +0200

Hi.
I am new to Cocoa as well as mailing lists. So please tell me, if I am doing something "unpolite". And please excuse my bad writing. I am not a native english speaking person.


I started with "Cocoa® Programming for Mac® OS X, Third Edition" a few days ago. The challenges seem to be not so easy. I looked around an found this...
http://www.cocoabuilder.com/archive/message/cocoa/2008/7/16/213146
... for one of the challenges (chapter 5). Now I am wondering, because it seems to me the "example" is "wasting code". I used the "example", but the "extra" method setoutString is kinda useless. After a bit thinking I did this.... (see below). I didn't use the "extra" method and it works fine. So my question is, did I just do something not- Cocoa-like and am I still thinking to much C? Did i found a better/ shorter way or did I made a fundamental mistake?


CountController.m--------------
@implementation CountContoller
- (id)init
{
  if(self = [super init])  // single = is intentional
    NSLog(@"-[%@ init]", [self className]);
  return self;
}

- (IBAction)countIt:(id)sender;
{
NSString *userString;
NSLog(@"Counting char");
userString = [intextField stringValue];
[outtextField setStringValue:[NSString stringWithFormat: @"%d", [userString length]]];
}
//deleted/unused setOutString code here...
@end


CountController.h--------------------
#import <Cocoa/Cocoa.h>

@interface CountContoller : NSObject
{
	IBOutlet NSTextField *intextField;
	IBOutlet NSTextField *outtextField;
}
- (IBAction)countIt:(id)sender;
//-(void) setOutString: (NSString*)outString;

@end





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: wasting space?
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Memory Leak in XIB file?
  • Next by Date: Re: Cocoa Programming for Mac OsX Third Edition eBook search
  • Previous by thread: Re: Memory Leak in XIB file?
  • Next by thread: Re: wasting space?
  • Index(es):
    • Date
    • Thread