How about a Pair category on NSNumber that uses associated objects, something like the code below (untested, may require iOS4 as I'm not sure when associated objects were introduced).
#import <objc/runtime.h>
@implementation NSNumber(Pair)
#define PAIR_KEY 'p'
- (NSNumber *) pairNumber:(NSNumber *)second
{
char secondKey = PAIR_KEY;
objc_setAssociatedObject(self, &secondKey, second, OBJC_ASSOCIATION_RETAIN);
return self;
}
- (NSNumber *) pairedNumber
{
char secondKey = PAIR_KEY;
NSNumber *associatedObject = (NSNumber *)objc_getAssociatedObject(self, &secondKey);
return associatedObject;
}
@end
You would use it like so:
BOOL myBool = NO;
NSNumber *storedBool = [NSNumber numberWithBool:myBool];
[myOtherNumber pairNumber:storedBool];
And to get it out:
NSNumber *boolNumber = [myOtherNumber pairedNumber];