Configuring the Barcode Text
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides a conceptual overview of configuring the barcode text on the IGBarcodeView™ control and demonstrates the procedure using a code example.

In this topic


Introduction

Barcode text summary

The IGBarcodeView, by default, displays the barcode text under the barcode and by setting the showText property to YES or NO can toggle its visibility. All barcode types support text, except the following.

  • IGBarcodeTypePlanet
  • IGBarcodeTypePostNet
Note: More information about the supported barcode types can be found in the Barcode Types topic.

By default, the text shown under the barcodes uses the HelveticaNeue-Bold font. The size of the font is calculated at runtime based off the bounds of the IGBarcodeView. To change the font used, set the fontName property to the NSString name of the font.


Configuring the Barcode Text – Code Example

Description

The code example below creates an instance of the IGBarcodeView and changes the default font.

Preview

Prerequisites

This code example requires the inclusion of the IG framework; details about how to add this framework are available in the Adding the IG Framework File topic.

Code

In Objective-C:

CGRect barcodeRect = CGRectMake(0, 0, 275, 175);
IGBarcodeView *barcodeEAN13 = [[IGBarcodeView alloc] initWithFrame:barcodeRect barcodeType:IGBarcodeTypeEAN13];
[barcodeEAN13 setValue:@"5901234123457"];
barcodeEAN13.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight|
        UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleBottomMargin|
        UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleTopMargin;
barcodeEAN13.fontName = [UIFont fontWithName:@"MarkerFelt-Wide" size:0].fontName;
barcodeEAN13.center = self.view.center;
[self.view addSubview:barcodeEAN13];

In C#:

RectangleF barcodeRect = new RectangleF(0, 0, 275, 175);
IGBarcodeView barcodeEAN13 = IGBarcodeView.CreateBarcodeFrame(IGBarcodeType.IGBarcodeTypeEAN13, barcodeRect);
barcodeEAN13.AutoresizingMask = UIViewAutoresizing.FlexibleWidth|UIViewAutoresizing.FlexibleHeight|
                                UIViewAutoresizing.FlexibleLeftMargin|UIViewAutoresizing.FlexibleBottomMargin|
                                UIViewAutoresizing.FlexibleRightMargin|UIViewAutoresizing.FlexibleTopMargin;
barcodeEAN13.SetValue ("5901234123457");
barcodeEAN13.FontName = UIFont.FromName ("MarkerFelt-Wide", 0).Name;
barcodeEAN13.Center = this.View.Center;
this.View.Add (barcodeEAN13);

Related Content

Topics

The following topic provides additional information related to this topic.

Topic

Purpose

The topics in this group cover enabling, configuring, and using the IGBarcodeView control’s supported features.