Its hard to tell you much about that error without seeing more code.
Not sure why you're getting errors trying to extend NSString. Seems odd, but I'm not at my mac right now so i cant test it out. Instead, you could do this:
Code:
typedef enum _StringType
{
Input, Received
} StringType;
@interface MyObject: NSObject
{
NSString* theString;
StringType type;
}
@property (nonatomic, readonly) NSString* theString;
@property (readonly) StringType type;
-(id) initWithString:(NSString*) aString andType:(StringType)type;
@end
@implementation
//im sure you can figure out what goes here.
@end
//when you recieve something over wifi
MyObject* obj = [[MyObject alloc] initWithString: @"whatever was received" andType: Received ];
[myArrayOfObjects addObject: obj];
[obj release];
//when something new is input by the user
MyObject* obj = [[MyObject alloc] initWithString: @"whatever was input" andType: Input];
[myArrayOfObjects addObject: obj];
[obj release];
//in your table
-(UITableViewCell*)cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
UITableViewCell* cell;
//...
MyObject* obj = [myArrayOfObject objectAtIndex:indexPath.row];
if( obj.type == Received )
{
cell.textColor = [UIColor redColor];
}
else if( obj.type == Input )
{
cell.textColor = [UIColor greenColor];
}
cell.text = obj.theString;
}