Qco for iOS manual page. - sbkro/Qco_for_iOS GitHub Wiki

How to install.

  1. Download Qco and build the project.
  2. Add "QCQRCode.h" and "libQco.a" in Xcode.
  3. In [TARGETS] -> [Build Phase] -> [Link Binary With Library], add "libQco.a", "UIKit.framework", "Foundation.framework" and "CoreGraphics.framework".
  4. Rename implementation file as follow. Because this library is wrapped C++ source code.
 XXXX.m -> XXXX.mm

How to use.

Qco has been designed to be able to make QR code in three steps.

  1. Initialize.
  2. Set parameters. (Option)
  3. Encode.
#inclide "QCQRCode.h"
...
// Initialize
QCQRCode * encoder = [[QCQRCode alloc] init];
// Set parameters.
encoder.moduleSize = 10;
// Encode
UIImage * qrcode = [encoder encodeWithText:@"Hello Qco."];

Method

(id) init;

Initialize Method. At this time, parameters of this class is initialized as follow.If you would like to change initial value, use properties.

  • moduleSize : 1px
  • correctLevel : Low (QCErrorCorrectLevelLow)
  • symbolVersion : Automatioc. (Change by text size.)
  • fgColor : black
  • bgColor : white

(UIImage *) encodeWithText: (NSString *) text;

This method convert QR Code image from NSString.if encode is failed, this method will return nil.

Property

int moduleSize

pixel size per a module. If the value is bigger, QR code is increased.

enum QCErrorCorrectLevel correctLevel;

Error Correction Level of QR Code. If the value is bigger, QR Code size is increased.

int symbolVersion;

Version of QR Code. Its range is from 1 to 40. If the value big, QR Code size is increased.

UIColor * fgColor;

Foreground Color of QR Code

UIColor * bgColor;

Background Color of QR Code

Sample Code

License

MIT Licence.

Operating Environment

  • iOS 5.1