Does the AGSTextSymbol support the text template any more?

2322
4
09-09-2014 07:36 PM
lynnwang
New Contributor II

Hi,

Earlier version of SDK can set the text content fromw values from the graphic's attributes like below:

AGSTextSymbol *textSymbol = [AGSTextSymbol textSymbolWithTextTemplate:@"${pointID}" color:[UIColor redColor]];

How to do this in recent version?

0 Kudos
4 Replies
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

Hello Lynn,

I think the method still using in 10.2.3. Please check this online documentation:10.2.3: AGSTextSymbol Class Reference

Hope this help.

0 Kudos
lynnwang
New Contributor II

Hi, Yue!

      I red a document before. It saids the porperty 'text' will replace the porerty 'text template' after v10.2.2.

      I tried 'text' porperty with the token like ${pointID}. But it doesn't work.

      Did you test this function before? ??

       Does it works?

       If so , please show me some codes.

      Thanks.

0 Kudos
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

Hi Lynn,

I am not really sure what is ${pointID}? Is it point to your database field or something else?

Here are two snippet code to use this AGSTextSymbol textSymbolWith Text method:

NSString *stopString = @"";

  if (stopNumber != NSNotFound) {

  stopString = [NSString stringWithFormat:@"%d", stopNumber];

  }

  AGSTextSymbol *ts = [AGSTextSymbol textSymbolWithText:stopString color:[UIColor blackColor]];

Or

NSMutableString *word = [NSMutableString stringWithFormat:@"Hello world"];

AGSTextSymbol *txtSymbol = [AgSTextSymbol textSymbolWithText:word color:[UIColor redColor]];

0 Kudos
lynnwang
New Contributor II

Hi, Yue

     Yes, the pointID is a field name of a graphic. In the old version of iOS SDK, I can use the property ‘textTemplate’ to set the text symbol text content of a graphic using its attribute field name but not a very string (just like your codes above). That will be very convenient.  This function is very similar with the AGSCalloutTemplate 's titleTemplate.

   I just like to know wether the AGSTextSymbol still supports this kind of template function.

0 Kudos