Configuring the Barcode Color
Send Feedback

Glossary Item Box

Topic Overview


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

In this topic


Barcode color summary

The IGBarcodeView control exposes properties for separately configuring the display color of both the barcode and its text. By default, the IGBarcodeView displays the barcode and text in black; however, each of these elements can have different colors independent of one another through properties exposed on the IGBarcodeView. To change the barcode color, set the barcodeColor property using a UIColor and to change the text color set the textColor property using a UIColor.

Configuring the Barcode Color – Code Example


The code example below creates an instance of the IGBarcodeView and changes the barcode and text color.


Following is a preview of the results.


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.


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|
barcodeEAN13.barcodeColor = [UIColor colorWithRed:84/255.0f green:134/255.0f blue:196/255.0f alpha:1.0f];
barcodeEAN13.textColor = [UIColor grayColor]; =;
[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|
barcodeEAN13.SetValue ("5901234123457");
barcodeEAN13.BarcodeColor = new UIColor (84 / 255.0f, 134 / 255.0f, 196 / 255.0f, 1.0f);
barcodeEAN13.TextColor = UIColor.Gray;
barcodeEAN13.Center = this.View.Center;
this.View.Add (barcodeEAN13);

Related Content


The following topic provides additional information related to this topic.



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