Re: Array operators [SOLVED]
Re: Array operators [SOLVED]
- Subject: Re: Array operators [SOLVED]
- From: Julio Cesar Silva dos Santos <email@hidden>
- Date: Wed, 5 Apr 2006 19:02:01 -0300
Use a value transformer to add 1 to the value, see <http://
developer.apple.com/documentation/Cocoa/Conceptual/
ValueTransformers/index.html>.
mmalc
Thanks for the reply, it worked smoothly. This is the code I wrote in
case one day someone will need it:
PositionTransformer.h
=====================
#import <Cocoa/Cocoa.h>
@interface PositionTransformer : NSValueTransformer {
}
@end
PositionTransformer.m
=====================
#import "PositionTransformer.h"
@implementation PositionTransformer
+ (Class)transformedValueClass
{
return [NSString class];
}
+ (BOOL)allowsReverseTransformation
{
return NO;
}
- (id)transformedValue:(id)value
{
if (value == nil)
{
return nil;
}
if ([value respondsToSelector: @selector(intValue)])
{
int intIndex = [value intValue];
NSString * position = [NSString stringWithFormat:@"%d",intIndex + 1];
return position;
} else
{
return [NSString stringWithString:@""];
}
}
@end
Julio Cesar Santos
email@hidden
eMac 1GHz ComboDrive
1GB RAM
Linux User #359973
_______________________________________________
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