iOS--------条形码

UIImageView* imageView1 = [[UIImageView alloc]init];

[self.view addSubview:imageView1];

NSData *data = [@"1231321" dataUsingEncoding:NSASCIIStringEncoding];

CIFilter *filter = [CIFilter filterWithName:@"CICode128BarcodeGenerator"];

[filter setValue:data forKey:@"inputMessage"];

[filter setValue:[NSNumber numberWithInteger:0] forKey:@"inputQuietSpace"];

UIImage* iamge = [UIImage imageWithCIImage:filter.outputImage];

imageView1.frame = CGRectMake(0, 80, iamge.size.width, iamge.size.height);

imageView1.image =iamge;

你可能感兴趣的:(iOS--------条形码)