LoginSignup
52
53

More than 5 years have passed since last update.

iOS で QR リーダを最速で実装する

Last updated at Posted at 2014-08-18

少し昔なら ZXing というライブラリがあって定番でしたが、今は iOS7 から AVFoundation が標準で QR を読んでくれます。
ZXing 重そうだったので、標準の API 使うとコードの量が減っていい感じです。

が、使うにも AVFoundation まわりのアレコレがとても面倒くさいです。
そこで手前味噌ですが薄い感じにらっぱーを書いたので紹介します。

pod 'KIFastQR'

KIFastQRCaptureView *fastQR = [[KIFastQRCaptureView alloc] initWithFrame:self.view.frame];
[fastQR startCaptureWithDelegate:self];
[self.view addSubview:fastQR];

で delegate メソッドをインプリします

- (void)fastQRView:(UIView *)fastQRView captureOutput:(NSString *)obtainedString {
    NSLog(@"%@", obtainedString);
}

KIFastQR ということでいかにも速そうですが標準の API を普通に使ってるだけです。

:sushi:

52
53
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
52
53