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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to