Search code examples
iphoneioszxingzbar-sdk

Generate BarCode for UIImageView


I want to generate a barcode on some UIImage or UIImageView. Is it possible.I am using This for generating the barcode.

Please help me. Thanks


Solution

  • Another option would be to use the URL of an online barcode generator as the source for a UIImage. For example:

    NSString *barCodeValue = @"0123456789";
    NSString *barCodeURL = [NSString stringWithFormat:@"http://www.barcodesinc.com/generator/image.php?code=%@&style=197&type=C128B&width=200&height=100&xres=1&font=3", barCodeValue];
    barCodeImage.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:barCodeURL]]];