What you are trying to do is technically good, but at some point you need to call [super init]. If your class method initdoes a lot of the general initialization used by other methods initWith..., then put it there [super init]. Also, always make sure the class was initd before trying to play with instance variables.
- (id) initWithKeyPadType: (int)value
{
self = [self init];
if( self != nil )
{
[self setKeyPadType:value];
}
return self;
}
- (id) init
{
self = [super init];
if (!self) return nil;
NSNumberFormatter *formatter = [[[NSNumberFormatter alloc] init]
autorelease];
decimalSymbol = [formatter decimalSeparator];
...