AnsweredAssumed Answered

AGSTextSymbol missing properties after encodeToJSON

Question asked by jamesrichards on Jun 10, 2014
Latest reply on Jun 11, 2014 by DGoyal-esristaff
Some properties are missing after encoding a text symbol to JSON. Most notably the color and borderLineWidth. This makes it difficult to rehydrate the symbol later. Example:

AGSTextSymbol *textSymbol = [[AGSTextSymbol alloc] initWithText:@"Hello World" color:[UIColor redColor]]; textSymbol.fontSize = 14; textSymbol.borderLineWidth = 4; textSymbol.borderLineColor = [[AGSColor alloc] initWithRed:1 green:1 blue:1 alpha:.8]; NSDictionary *dict = [textSymbol encodeToJSON]; NSData *data = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:nil]; NSString *json = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"%@", json);


Results in this:

{   "text" : "Hello World",   "type" : "esriTS",   "backgroundColor" : [     0,     0,     0,     0   ],   "verticalAlignment" : "middle",   "horizontalAlignment" : "center",   "borderLineColor" : [     255,     255,     255,     204   ],   "font" : {     "weight" : "normal",     "style" : "normal",     "size" : 14,     "decoration" : "none",     "family" : "Helvetica"   } }

Outcomes