Configuring Text Variables
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides a conceptual overview of adding and removing text variables from the IGLabel™ control with code examples for each.

Required background

The following table lists the topics required as a prerequisite to understanding this topic.

Topic

Purpose

Adding the Label Framework File

This topic explains the requirements for adding the grid framework file to an Xcode project; a requirement for using the IGLabel control.


In this topic


Introduction

Configuring text variables summary

Dynamic text variables are unique combinations of characters that act as placeholders and are replaced with a specific value when processing a text value. The IGLabel accommodates the usage of dynamic text values and adds text variables using the addTextVariable:value: method. Defined text variables automatically updates with the configured value whenever the text property changes. Use the updateTextVariableValue:value: method for updating a previously defined text variable.

Call the removeTextVariable: method and specifying the variable to stop text variables from automatically replacing text. Use the resetTextVariables method to remove all text variable entries.


Adding Text Variables – Code Example

Description

The following code demonstrates instantiating an IGLabel with a frame size equal to the size of the view, creating a variable “{LastName}” with a replacement variable of “Jones.” Setting the text is what actually triggers the automatic replacement.

Adding Text Variables - Code

In C#:

IGLabel label = new IGLabel();
label.Frame = new RectangleF(0, 0, this.View.Frame.Size.Width, this.View.Frame.Size.Height);
label.AddTextVariable("{LastName}", "Jones");
label.Text = "Hello Mr. {LastName}, welcome back to the app.";
(this.View).AddSubview(label);

In Objective-C:

IGLabel *label = [[IGLabel alloc] init];label.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);[label addTextVariable:@"{LastName}" value:@"Jones"];label.text = @"Hello Mr. {LastName}, welcome back to the app.";[self.view addSubView:label];

Removing Text Variables – Code Example

Description

Uses the IGLabel instance, created from the above Adding Text Variables – Code Example, calls and supplies the removeTextVariable: method with the text variable for removal.

Removing Text Variables - Code

In C#:

label.RemoveTextVariable("{LastName}");

In Objective-C:

[label removeTextVariable:@"{LastName}"];

Related Content

Topics

The following topics provide additional information related to this topic.

Topic

Purpose

This topic provides basic information about creating an instance of the IGLabel and styling text to help you get up and running with this control.

This section serves as an introduction to the IGLabel’s key features and functionalities.